This commit is contained in:
Treeku
2014-05-02 16:30:46 +01:00
115 changed files with 1732 additions and 717 deletions
+6 -1
View File
@@ -60,8 +60,13 @@ odb/chatRooms/je.info.*
odb/resourcehistory/je.info.*
odb/resourceroots/je.info.*
odb/resources/je.info.*
odb/auction/je.info.*
<<<<<<< HEAD
odb/auction/je.info.*
odb/swgobjects/je.info.*
=======
odb/auction/je.info.*
odb/bounties/je.info.*
>>>>>>> 12ca3ae66170fcfe09d848a7eea529041b9af5ad
# External tool builders
.externalToolBuilders/
Binary file not shown.
View File
+40
View File
@@ -0,0 +1,40 @@
import sys
from java.lang import System
from resources.common import OutOfBand
from resources.common import ProsePackage
import main.NGECore
def setup():
return
def run(core, actor, target, commandString):
if target == None:
return
#if !actor.hasSkill('Politician'):
#You must be a Politician to enable city zoning.
#actor.sendSystemMessage('@city/city:zoning_skill', 0)
#return
thisCity = main.NGECore.getInstance().playerCityService.getCityObjectIsIn(actor)
if thisCity == None:
#not_in_city_limits
actor.sendSystemMessage('@city/city:not_in_city_limits', 0)
return
if thisCity.getMayorID()!=actor.getObjectID() and not thisCity.isMilitiaMember(actor.getObjectID()):
#You must be the mayor of the city or a member of the city militia to grant zoning rights.
actor.sendSystemMessage('@city/city:grant_rights_fail', 0)
actor.sendSystemMessage('thisCity.getMayorID() %s' % thisCity.getMayorID(), 0)
actor.sendSystemMessage('actor.getObjectID() %s' % actor.getObjectID(), 0)
return
#You have granted %TO zoning rights for 24 hours.
actor.sendSystemMessage(OutOfBand.ProsePackage("@city/city:rights_granted_self", "TO", target.getCustomName()), 0)
target.setAttachment('Has24HZoningFor',thisCity.getCityID())
target.setAttachment('Has24HZoningUntil',System.currentTimeMillis()+60*60*24)
target.sendSystemMessage(OutOfBand.ProsePackage("@city/city:rights_granted", "TO", thisCity.getCityName()), 0)
return
+2 -5
View File
@@ -113,11 +113,8 @@ def run(core, actor, target, commandString):
actor.removeAbility("admin")
playerObject.setGodLevel(0)
elif command == 'setBounty' and arg1:
if not core.missionService.addToExistingBounty(actor, int(arg1)):
core.missionService.createNewBounty(actor, int(arg1))
actor.sendSystemMessage('Your bounty has been set to an additional ' + str(arg1) + ' credits.', 0)
elif command == 'setBounty':
core.playerService.sendSetBountyWindow(actor, actor)
return
return
@@ -0,0 +1,15 @@
import sys
from services.housing import HouseTemplate
from engine.resources.scene import Point3D
def setup(housingTemplates):
houseTemplate = HouseTemplate("object/tangible/deed/city_deed/shared_garden_tatooine_sml_01_deed.iff", "object/building/player/city/shared_garden_tatooine_sml_01.iff", 0)
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(1, 2, 3))
houseTemplate.addPlaceablePlanet("tatooine")
houseTemplate.addPlaceablePlanet("dantooine")
houseTemplate.addPlaceablePlanet("lok")
houseTemplate.setDefaultItemLimit(0)
housingTemplates.put(houseTemplate.getDeedTemplate(), houseTemplate)
return
@@ -0,0 +1,12 @@
import sys
from services.housing import HouseTemplate
from engine.resources.scene import Point3D
def setup(housingTemplates):
houseTemplate = HouseTemplate("object/tangible/deed/city_deed/shared_shuttleport_tatooine_deed.iff", "object/building/tatooine/shared_shuttleport_tatooine.iff", 1)
houseTemplate.addBuildingSign("object/tangible/sign/player/shared_house_address.iff", Point3D(float(3.5),float(-0.3),float(3.5)))
houseTemplate.addPlaceablePlanet("tatooine")
houseTemplate.setDefaultItemLimit(0)
housingTemplates.put(houseTemplate.getDeedTemplate(), houseTemplate)
return
@@ -1,4 +1,14 @@
import sys
from engine.resources.scene import Point3D
from engine.resources.scene import Quaternion
def setup(core, object):
sign = core.objectService.createChildObject(object, 'object/tangible/sign/player/shared_house_address.iff', -13.7, 3, 9.1, -1, 0, -1)
print(sign)
object.setAttachment("structureSign", sign)
structureterminal = core.objectService.createChildObject(object, 'object/tangible/terminal/shared_terminal_player_structure.iff', -17.2, 1.5 , 8, 1, 0 ,4)
#structureterminal.setAttachment('radial_filename', 'structure_management_terminal')
structureterminal.setAttachment('housing_parentstruct', object)
return
@@ -1,4 +1,10 @@
import sys
from resources.datatables import Options
def setup(core, object):
return
object.setAttachment('radial_filename', 'object/conversation');
object.setAttachment('conversationFile','imp_recruiter')
object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
object.setStfFilename('mob/creature_names')
object.setStfName('imperial_recruiter')
return
@@ -1,4 +1,10 @@
import sys
from resources.datatables import Options
def setup(core, object):
return
object.setAttachment('radial_filename', 'object/conversation');
object.setAttachment('conversationFile','imp_recruiter')
object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
object.setStfFilename('mob/creature_names')
object.setStfName('imperial_recruiter')
return
@@ -1,4 +1,10 @@
import sys
from resources.datatables import Options
def setup(core, object):
return
object.setAttachment('radial_filename', 'object/conversation');
object.setAttachment('conversationFile','imp_recruiter')
object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
object.setStfFilename('mob/creature_names')
object.setStfName('imperial_recruiter')
return
@@ -1,4 +1,10 @@
import sys
from resources.datatables import Options
def setup(core, object):
return
object.setAttachment('radial_filename', 'object/conversation');
object.setAttachment('conversationFile','imp_recruiter')
object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
object.setStfFilename('mob/creature_names')
object.setStfName('imperial_recruiter')
return
@@ -1,4 +1,10 @@
import sys
from resources.datatables import Options
def setup(core, object):
return
object.setAttachment('radial_filename', 'object/conversation');
object.setAttachment('conversationFile','imp_recruiter')
object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
object.setStfFilename('mob/creature_names')
object.setStfName('imperial_recruiter')
return
@@ -1,4 +1,10 @@
import sys
from resources.datatables import Options
def setup(core, object):
return
object.setAttachment('radial_filename', 'object/conversation');
object.setAttachment('conversationFile','imp_recruiter')
object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
object.setStfFilename('mob/creature_names')
object.setStfName('imperial_recruiter')
return
@@ -1,4 +1,10 @@
import sys
from resources.datatables import Options
def setup(core, object):
return
object.setAttachment('radial_filename', 'object/conversation');
object.setAttachment('conversationFile','reb_recruiter')
object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE)
object.setStfFilename('mob/creature_names')
object.setStfName('rebel_recruiter')
return
@@ -1,4 +1,8 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'deeds/structureDeed')
return
def use(core, actor, object):
return
@@ -1,4 +1,8 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'deeds/structureDeed')
return
def use(core, actor, object):
return
@@ -1,7 +1,7 @@
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'vehicleDeed')
object.setAttachment('radial_filename', 'deeds/vehicleDeed')
return
def use(core, actor, object):
@@ -21,4 +21,4 @@ def use(core, actor, object):
core.simulationService.add(vehicle, vehicle.getPosition().x, vehicle.getPosition().z, True)
actor.setAttachment('activeVehicleID', vehicle.getObjectID())
return
return
@@ -2,6 +2,6 @@ import sys
def setup(core, object):
object.setAttachment('radial_filename', 'terminal/bank')
core.mapService.addLocation(object.getPlanet(), 'Bank Terminal', object.getPosition().x, object.getPosition().z, 41, 42, 0)
core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_bank', object.getPosition().x, object.getPosition().z, 2, 42, 0)
return
@@ -1,7 +1,6 @@
import sys
def setup(core, object):
core.mapService.addLocation(object.getPlanet(), 'Bazaar Terminal', object.getPosition().x, object.getPosition().z, 41, 43, 0)
core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_bazaar', object.getPosition().x, object.getPosition().z, 41, 43, 0)
return
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:junk_dealer', object.getPosition().x, object.getPosition().z, 26, 81, 0)
return
@@ -2,5 +2,6 @@ import sys
def setup(core, object):
object.setAttachment('radial_filename', 'terminal/cloning_terminal')
return
@@ -2,6 +2,6 @@ import sys
def setup(core, object):
core.mapService.addLocation(object.getPlanet(), 'Artisan Mission Terminal', object.getPosition().x, object.getPosition().z, 41, 21, 0)
core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_mission_artisan', object.getPosition().x, object.getPosition().z, 41, 76, 0)
return
@@ -1,7 +1,6 @@
import sys
def setup(core, object):
core.mapService.addLocation(object.getPlanet(), 'Entertainer Mission Terminal', object.getPosition().x, object.getPosition().z, 41, 24, 0)
return
object.setAttachment("terminalType", 2)
core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_mission_entertainer', object.getPosition().x, object.getPosition().z, 41, 75, 0)
return
@@ -1,7 +1,6 @@
import sys
def setup(core, object):
core.mapService.addLocation(object.getPlanet(), 'Imperial Mission Terminal', object.getPosition().x, object.getPosition().z, 41, 46, 0)
core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_mission_imperial', object.getPosition().x, object.getPosition().z, 41, 80, 0)
return
@@ -1,7 +1,6 @@
import sys
def setup(core, object):
core.mapService.addLocation(object.getPlanet(), 'Rebel Mission Terminal', object.getPosition().x, object.getPosition().z, 41, 45, 0)
core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_mission_rebel', object.getPosition().x, object.getPosition().z, 41, 79, 0)
return
@@ -1,4 +1,5 @@
import sys
def setup(core, object):
core.mapService.addLocation(object.getPlanet(), '@map_loc_cat_n:terminal_mission_scout', object.getPosition().x, object.getPosition().z, 41, 77, 0)
return
@@ -24,6 +24,10 @@ def createRadial(core, owner, target, radials):
radials.add(RadialOptions(3, 121, 0, '@city/city:non_citizen_city_status'))
radials.add(RadialOptions(3, 122, 0, '@city/city:rank_info_t'))
radials.add(RadialOptions(3, 123, 0, '@city/city:citizen_list_t'))
radials.add(RadialOptions(3, 230, 0, '@city/city:revoke_citizenship'))
radials.add(RadialOptions(3, 231, 0, 'Add 10 citizens'))
radials.add(RadialOptions(3, 232, 0, 'Deduct 10 citizens'))
return
@@ -80,14 +84,26 @@ def handleSelection(core, owner, target, option):
if owner is not None:
handleCitizenList(core, owner, target, option)
return
def handleSetCityName(core, owner, target, option):
window = core.suiService.createInputBox(2,'@city/city:city_name_new_t','@city/city:city_name_new_d', owner, target, 0)
returnList = Vector()
returnList.add('txtInput:LocalText')
window.addHandler(0, '', Trigger.TRIGGER_OK, returnList, setnameCallBack)
window.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnList, setnameCallBack)
core.suiService.openSUIWindow(window);
if option == 231:
if owner is not None:
handle10Add(core, owner, target, option)
return
if option == 232:
if owner is not None:
handle10Deduct(core, owner, target, option)
return
def handle10Add(core, owner, target, option):
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
playerCity.Add10MoreCitizens()
return
def handle10Deduct(core, owner, target, option):
playerCity = main.NGECore.getInstance().playerCityService.getPlayerCity(owner)
playerCity.Deduct10Citizens()
return
def setnameCallBack(owner, window, eventType, returnList):
+12 -12
View File
@@ -14,14 +14,14 @@ def addPlanetSpawns(core, planet):
objSvc = core.objectService
#Dark Temple Area
#Structures
stcSvc.spawnObject('object/building/military/shared_military_base_police_station_imperial_lok_otto.iff', 'kaas', long(0), float(-5117.8), float(80.0), float(-2314.1), float(0), float(0))
stcSvc.spawnObject('object/building/player/shared_player_house_corellia_medium_style_01.iff', 'kaas', long(0), float(-5078.6), float(80.0), float(-2302.5), float(0), float(0))
stcSvc.spawnObject('object/building/general/shared_bunker_imperial_weapons_research_facility_01.iff', 'kaas', long(0), float(-5159.5), float(80.0), float(-2298.7), float(0), float(0))
stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5163.9), float(79.0), float(-2369.6), float(0.71), float(0.71))
stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5163.9), float(79.0), float(-2351.6), float(0.71), float(0.71))
stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5072.1), float(79.0), float(-2369.6), float(-0.71), float(0.71))
stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5072.1), float(79.0), float(-2351.6), float(-0.71), float(0.71))
stcSvc.spawnObject('object/building/military/shared_outpost_cloning_facility_s02.iff', long(0), 'kaas', long(0), float(-5072.1), float(80.0), float(-2279.5), float(0.71), float(0), float(-0.71), float(0))
#stcSvc.spawnObject('object/building/military/shared_military_base_police_station_imperial_lok_otto.iff', 'kaas', long(0), float(-5117.8), float(80.0), float(-2314.1), float(0), float(0))
#stcSvc.spawnObject('object/building/player/shared_player_house_corellia_medium_style_01.iff', 'kaas', long(0), float(-5078.6), float(80.0), float(-2302.5), float(0), float(0))
#stcSvc.spawnObject('object/building/general/shared_bunker_imperial_weapons_research_facility_01.iff', 'kaas', long(0), float(-5159.5), float(80.0), float(-2298.7), float(0), float(0))
#stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5163.9), float(79.0), float(-2369.6), float(0.71), float(0.71))
#stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5163.9), float(79.0), float(-2351.6), float(0.71), float(0.71))
#stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5072.1), float(79.0), float(-2369.6), float(-0.71), float(0.71))
#stcSvc.spawnObject('object/building/content/aurilia/shared_aurilia_pyramid_hut.iff', 'kaas', long(0), float(-5072.1), float(79.0), float(-2351.6), float(-0.71), float(0.71))
#stcSvc.spawnObject('object/building/military/shared_outpost_cloning_facility_s02.iff', 'kaas', long(0), float(-5072.1), float(80.0), float(-2279.5), float(0.71), float(0), float(-0.71), float(0))
#Terminals
stcSvc.spawnObject('object/tangible/terminal/shared_terminal_bank.iff', 'kaas', long(0), float(-5080.8), float(80.0), float(-2275.7), float(-0.71), float(0.71))
@@ -58,20 +58,20 @@ def addPlanetSpawns(core, planet):
#Village of the Descendants Area
stcSvc.spawnObject('object/building/general/shared_cave_01.iff', 'kaas', long(0), float(3348.1), float(110), float(2562.1), float(0), float(0))
#stcSvc.spawnObject('object/building/general/shared_cave_01.iff', 'kaas', long(0), float(3348.1), float(110), float(2562.1), float(0), float(0))
#Kaas City Ruins
#Tomb of Vitiate
#Northwest Cave
stcSvc.spawnObject('object/building/general/shared_cave_01.iff', 'kaas', long(0), float(-6135.3), float(185), float(6575.0), float(0), float(0))
#stcSvc.spawnObject('object/building/general/shared_cave_01.iff', 'kaas', long(0), float(-6135.3), float(185), float(6575.0), float(0), float(0))
#Abandoned Separatist Base
stcSvc.spawnObject('object/building/military/shared_military_base_police_station_rebel_style_01.iff', 'kaas', long(0), float(-3538), float(80), float(6758), float(0), float(0))
#stcSvc.spawnObject('object/building/military/shared_military_base_police_station_rebel_style_01.iff', 'kaas', long(0), float(-3538), float(80), float(6758), float(0), float(0))
#Sith Meditation Chamber
stcSvc.spawnObject('object/building/player/shared_player_house_sith_meditation_room.iff', 'kaas', long(0), float(4766), float(126), float(-7307), float(0), float(0))
#stcSvc.spawnObject('object/building/player/shared_player_house_sith_meditation_room.iff', 'kaas', long(0), float(4766), float(126), float(-7307), float(0), float(0))
#Large Ruin
stcSvc.spawnObject('object/static/structure/dantooine/shared_dant_jedi_main_structure.iff', 'kaas', long(0), float(-434), float(77), float(-2252), float(0), float(0))
+7
View File
@@ -23,6 +23,13 @@ def addPlanetSpawns(core, planet):
stcSvc.spawnObject('object/mobile/shared_junk_dealer_m_01.iff', 'tatooine', long(0), float(3525), float(4), float(-4804), float(0.70), float(0.71))
#stcSvc.spawnObject('object/mobile/shared_3po_protocol_droid_red.iff', 'tatooine', long(26582), float(-14.3), float(2.0), float(47.4), float(0.70), float(0.71))
impRecruiter = stcSvc.spawnObject('object/mobile/shared_dressed_imperial_officer_f.iff', 'tatooine', long(1280132), float(-6), float(1), float(9.2), float(0.70), float(0.71))
impRecruiter.setOptionsBitmask(264)
rebRecruiter = stcSvc.spawnObject('object/mobile/shared_dressed_rebel_recruiter_human_female_01.iff', 'tatooine', long(1082887), float(-30.5), float(-0.5), float(6.2), float(0.70), float(0.71))
rebRecruiter.setOptionsBitmask(264)
return
+46 -31
View File
@@ -45,9 +45,13 @@ import com.sleepycat.persist.EntityCursor;
import protocol.swg.chat.ChatSystemMessage;
import net.engio.mbassy.bus.config.BusConfiguration;
import resources.common.BountyListItem;
import resources.common.RadialOptions;
import resources.common.ThreadMonitor;
import resources.objects.creature.CreatureObject;
import resources.objects.guild.GuildObject;
import resources.objects.resource.GalacticResource;
import resources.objects.resource.ResourceRoot;
import services.AttributeService;
import services.BuffService;
import services.CharacterService;
@@ -71,8 +75,11 @@ import services.SurveyService;
import services.TerrainService;
import services.WeatherService;
import services.ai.AIService;
import services.bazaar.AuctionItem;
import services.bazaar.BazaarService;
import services.chat.ChatRoom;
import services.chat.ChatService;
import services.chat.Mail;
import services.collections.CollectionService;
import services.combat.CombatService;
import services.command.CombatCommand;
@@ -83,6 +90,8 @@ import services.guild.GuildService;
import services.LoginService;
import services.map.MapService;
import services.mission.MissionService;
import services.object.DuplicateId;
import services.object.ObjectId;
import services.object.ObjectService;
import services.object.UpdateService;
import services.pet.MountService;
@@ -110,6 +119,7 @@ import engine.resources.config.Config;
import engine.resources.config.DefaultConfig;
import engine.resources.container.Traverser;
import engine.resources.database.DatabaseConnection;
import engine.resources.database.ODBCursor;
import engine.resources.database.ObjectDatabase;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Point3D;
@@ -199,7 +209,6 @@ public class NGECore {
public InteractiveJythonAcceptor jythonAcceptor;
private InteractiveJythonServer jythonServer;
private ObjectDatabase creatureODB;
private ObjectDatabase mailODB;
private ObjectDatabase guildODB;
private ObjectDatabase objectIdODB;
@@ -208,11 +217,11 @@ public class NGECore {
private BusConfiguration eventBusConfig = BusConfiguration.Default(1, new ThreadPoolExecutor(1, 4, 1, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>()));
private ObjectDatabase buildingODB;
private ObjectDatabase auctionODB;
private ObjectDatabase resourcesODB;
private ObjectDatabase resourceRootsODB;
private ObjectDatabase resourceHistoryODB;
private ObjectDatabase swgObjectODB;
private ObjectDatabase bountiesODB;
public static boolean PACKET_DEBUG = false;
@@ -264,18 +273,17 @@ public class NGECore {
}
setGalaxyStatus(1);
creatureODB = new ObjectDatabase("creature", true, false, true);
buildingODB = new ObjectDatabase("building", true, false, true);
mailODB = new ObjectDatabase("mails", true, false, true);
guildODB = new ObjectDatabase("guild", true, false, true);
objectIdODB = new ObjectDatabase("oids", true, false, false);
duplicateIdODB = new ObjectDatabase("doids", true, false, true);
chatRoomODB = new ObjectDatabase("chatRooms", true, false, true);
resourcesODB = new ObjectDatabase("resources", true, false, true);
resourceRootsODB = new ObjectDatabase("resourceroots", true, false, true);
resourceHistoryODB = new ObjectDatabase("resourcehistory", true, false, true);
auctionODB = new ObjectDatabase("auction", true, false, true);
bountiesODB = new ObjectDatabase("bounties", true, false, true);
swgObjectODB = new ObjectDatabase("swgobjects", true, true, true, SWGObject.class);
mailODB = new ObjectDatabase("mails", true, true, true, Mail.class);
guildODB = new ObjectDatabase("guild", true, true, true, GuildObject.class);
objectIdODB = new ObjectDatabase("oids", true, true, true, ObjectId.class);
duplicateIdODB = new ObjectDatabase("doids", true, true, true, DuplicateId.class);
chatRoomODB = new ObjectDatabase("chatRooms", true, true, true, ChatRoom.class);
resourcesODB = new ObjectDatabase("resources", true, true, true, GalacticResource.class);
resourceRootsODB = new ObjectDatabase("resourceroots", true, true, true, ResourceRoot.class);
resourceHistoryODB = new ObjectDatabase("resourcehistory", true, true, true, GalacticResource.class);
auctionODB = new ObjectDatabase("auction", true, true, true, AuctionItem.class);
bountiesODB = new ObjectDatabase("bounties", true, true, true, BountyListItem.class);
// Services
loginService = new LoginService(this);
@@ -483,6 +491,7 @@ public class NGECore {
spawnService.loadMobileTemplates();
spawnService.loadLairTemplates();
spawnService.loadLairGroups();
spawnService.loadDynamicGroups();;
spawnService.loadSpawnAreas();
equipmentService.loadBonusSets();
@@ -497,24 +506,21 @@ public class NGECore {
}
private void cleanupCreatureODB() {
EntityCursor<CreatureObject> cursor = creatureODB.getCursor(Long.class, CreatureObject.class);
ODBCursor cursor = swgObjectODB.getCursor();
Iterator<CreatureObject> it = cursor.iterator();
List<CreatureObject> deletedObjects = new ArrayList<CreatureObject>();
while(it.hasNext()) {
CreatureObject creature = it.next();
if(!characterService.playerExists(creature.getObjectID()))
deletedObjects.add(creature);
while(cursor.hasNext()) {
SWGObject creature = (SWGObject) cursor.next();
if(!characterService.playerExists(creature.getObjectID()) && creature instanceof CreatureObject)
deletedObjects.add((CreatureObject) creature);
}
cursor.close();
Transaction txn = creatureODB.getEnvironment().beginTransaction(null, null);
for(CreatureObject creature : deletedObjects) {
creatureODB.delete(creature.getObjectID(), Long.class, CreatureObject.class, txn);
swgObjectODB.remove(creature.getObjectID());
}
txn.commitSync();
System.out.println("Deleted " + deletedObjects.size() + " creatures.");
}
@@ -600,8 +606,8 @@ public class NGECore {
return databaseConnection2;
}
public ObjectDatabase getCreatureODB() {
return creatureODB;
public ObjectDatabase getSWGObjectODB() {
return swgObjectODB;
}
public ObjectDatabase getMailODB() {
@@ -611,11 +617,7 @@ public class NGECore {
public ObjectDatabase getGuildODB() {
return guildODB;
}
public ObjectDatabase getBuildingODB() {
return buildingODB;
}
public ObjectDatabase getObjectIdODB() {
return objectIdODB;
}
@@ -744,6 +746,19 @@ public class NGECore {
return System.currentTimeMillis() - galacticTime;
}
public void closeODBs() {
swgObjectODB.close();
mailODB.close();
guildODB.close();
chatRoomODB.close();
resourcesODB.close();
resourceRootsODB.close();
resourceHistoryODB.close();
objectIdODB.close();
duplicateIdODB.close();
auctionODB.close();
}
}
+22 -14
View File
@@ -25,15 +25,16 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import resources.common.Console;
import engine.resources.common.CRC;
import resources.common.OutOfBand;
import resources.common.StringUtilities;
public class CommPlayerMessage extends SWGMessage {
private long objectId;
private String model;
private OutOfBand outOfBand;
private int time;
public CommPlayerMessage(long objectId, OutOfBand outOfBand) {
this.objectId = objectId;
this.outOfBand = outOfBand;
@@ -46,28 +47,35 @@ public class CommPlayerMessage extends SWGMessage {
@Override
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(200).order(ByteOrder.LITTLE_ENDIAN);
IoBuffer buffer = IoBuffer.allocate(50).order(ByteOrder.LITTLE_ENDIAN);
buffer.setAutoExpand(true);
buffer.putShort((short) 2);
buffer.putInt(0x594AD258);
buffer.put((byte) 0); // aurebesh borders on comm, space version? Can cause crashes
buffer.putLong(objectId);
/* Seen numbers:
* 52 (Starting Station Comms)
* 54 (Tansarii Comms)
* 57 (Supply Drops)
* 58 (Faction Covert->Overt)
* 68 (Imperial stop)
*/
buffer.put(outOfBand.serialize().array());
// Officer Supply Drop: 0x3E894347
// Rebel Faction Dude: 0x528CB3D7
buffer.putInt(0x528CB3D7); // model crc, can be anything w/o crashing
if (model == null)
buffer.putInt(0x3E894347);
else
buffer.putInt(CRC.StringtoCRC(model));
buffer.putInt(0); // sound
buffer.putShort((short) 0); // unk
buffer.putShort((short) 16576); // comm display time, unsure on how it's calculated (probably milliseconds)
if (time == 0)
buffer.putShort((short) 16576);
else
buffer.putShort((short) time);
buffer.flip();
Console.println("CPM: " + StringUtilities.bytesToHex(buffer.array()));
return buffer;
}
public void setModel(String model) {
this.model = model;
}
public void setTime(int time) {
this.time = time;
}
}
+5 -3
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.buffs;
import java.io.Serializable;
import java.nio.ByteOrder;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledFuture;
@@ -40,10 +41,11 @@ import com.sleepycat.persist.model.Persistent;
import engine.resources.common.CRC;
@Persistent(version=10)
public class Buff implements IDelta {
public class Buff implements IDelta, Serializable {
private static final long serialVersionUID = 1L;
@NotPersistent
private SimpleBufferAllocator bufferPool = new SimpleBufferAllocator();
private transient SimpleBufferAllocator bufferPool = new SimpleBufferAllocator();
private String group1, group2;
private int priority;
private float duration;
@@ -65,7 +67,7 @@ public class Buff implements IDelta {
private int totalPlayTime;
private byte decayCounter = 0;
@NotPersistent
private ScheduledFuture<?> removalTask;
private transient ScheduledFuture<?> removalTask;
private int stacks = 1;
private long groupBufferId;
private int buffCRC;
+5 -1
View File
@@ -21,10 +21,14 @@
******************************************************************************/
package resources.buffs;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
@Persistent
public class BuffItem {
public class BuffItem implements Serializable {
private static final long serialVersionUID = 1L;
private int affectAmount;
private int entertainerBonus;
private int invested;
+4 -2
View File
@@ -21,20 +21,22 @@
******************************************************************************/
package resources.buffs;
import java.io.Serializable;
import java.util.concurrent.ScheduledFuture;
import com.sleepycat.persist.model.NotPersistent;
import com.sleepycat.persist.model.Persistent;
@Persistent(version=1)
public class DamageOverTime {
public class DamageOverTime implements Serializable {
private static final long serialVersionUID = 1L;
private Buff buff;
private String type;
private int duration;
private int intensity;
@NotPersistent
private ScheduledFuture<?> task;
private transient ScheduledFuture<?> task;
private long startTime;
private String commandName;
+3 -1
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.common;
import java.io.Serializable;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
@@ -30,8 +31,9 @@ import com.sleepycat.persist.model.Persistent;
import resources.objects.Delta;
@Persistent
public final class AString extends Delta {
public final class AString extends Delta implements Serializable {
private static final long serialVersionUID = 1L;
private String string;
public AString() {
+34 -5
View File
@@ -21,15 +21,17 @@
******************************************************************************/
package resources.common;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import com.sleepycat.persist.model.Entity;
import com.sleepycat.persist.model.PrimaryKey;
@Entity(version=1)
public class BountyListItem implements Serializable {
@Entity
public class BountyListItem {
private static final long serialVersionUID = 1L;
@PrimaryKey
private long objectId;
private int creditReward;
@@ -37,7 +39,9 @@ public class BountyListItem {
private String faction;
private String name;
private List<Long> assignedHunters;
private List<Long> bountyPlacers;
private int failedAttempts;
public BountyListItem() { }
public BountyListItem(long objectId, int creditReward, String profession, String faction, String name) {
@@ -47,6 +51,7 @@ public class BountyListItem {
this.faction = faction;
this.setName(name);
this.setAssignedHunters(new ArrayList<Long>(3));
this.setBountyPlacers(new ArrayList<Long>());
}
public long getObjectId() {
@@ -87,6 +92,10 @@ public class BountyListItem {
public void addBounty(int amountToAdd) {
this.creditReward += amountToAdd;
}
public void deductBounty(int amountToDeduct) {
this.creditReward = this.creditReward - amountToDeduct;
}
public List<Long> getAssignedHunters() {
return assignedHunters;
@@ -103,4 +112,24 @@ public class BountyListItem {
public void removeBountyHunter(long objectId) {
assignedHunters.remove(objectId);
}
}
public List<Long> getBountyPlacers() {
return bountyPlacers;
}
public void setBountyPlacers(List<Long> bountyPlacers) {
this.bountyPlacers = bountyPlacers;
}
public int getFailedAttempts() {
return failedAttempts;
}
public void setFailedAttempts(int failedAttempts) {
this.failedAttempts = failedAttempts;
}
public void incrementFailedAttempts() {
this.failedAttempts += 1;
}
}
+3 -1
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.common;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import com.sleepycat.persist.model.Persistent;
@@ -28,8 +29,9 @@ import com.sleepycat.persist.model.Persistent;
import resources.objects.Delta;
@Persistent
public final class UString extends Delta {
public final class UString extends Delta implements Serializable {
private static final long serialVersionUID = 1L;
private String string;
public UString() {
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.gcw;
import java.io.Serializable;
import org.apache.mina.core.buffer.IoBuffer;
import com.sleepycat.persist.model.Persistent;
@@ -28,8 +30,9 @@ import com.sleepycat.persist.model.Persistent;
import resources.objects.Delta;
@Persistent(version=0)
public class CurrentServerGCWZoneHistory extends Delta implements Cloneable {
public class CurrentServerGCWZoneHistory extends Delta implements Cloneable, Serializable {
private static final long serialVersionUID = 1L;
private int lastUpdateTime;
private int percent;
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.gcw;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.MathContext;
@@ -29,12 +30,12 @@ import org.apache.mina.core.buffer.IoBuffer;
import com.sleepycat.persist.model.Persistent;
import engine.resources.scene.Point2D;
import resources.objects.Delta;
@Persistent(version=0)
public class CurrentServerGCWZonePercent extends Delta implements Cloneable {
public class CurrentServerGCWZonePercent extends Delta implements Cloneable, Serializable {
private static final long serialVersionUID = 1L;
private Point2D position;
private float radius = 0;
private BigDecimal weight;
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.gcw;
import java.io.Serializable;
import org.apache.mina.core.buffer.IoBuffer;
import com.sleepycat.persist.model.Persistent;
@@ -28,8 +30,9 @@ import com.sleepycat.persist.model.Persistent;
import resources.objects.Delta;
@Persistent(version=0)
public class OtherServerGCWZonePercent extends Delta implements Cloneable {
public class OtherServerGCWZonePercent extends Delta implements Cloneable, Serializable {
private static final long serialVersionUID = 1L;
private String zone = "";
private int percent = 50;
+3 -2
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.guild;
import java.io.Serializable;
import java.util.List;
import org.apache.mina.core.buffer.IoBuffer;
@@ -28,12 +29,12 @@ import org.apache.mina.core.buffer.IoBuffer;
import com.sleepycat.persist.model.Persistent;
import resources.objects.Delta;
import engine.resources.objects.SWGObject;
@Persistent(version=0)
public class Guild extends Delta {
public class Guild extends Delta implements Serializable {
private static final long serialVersionUID = 1L;
private int id;
private String abbreviation;
private String name;
+5 -1
View File
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.loot;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
/**
@@ -28,8 +30,10 @@ import com.sleepycat.persist.model.Persistent;
*/
@Persistent(version=0)
public class LootGroup {
public class LootGroup implements Serializable {
private static final long serialVersionUID = 1L;
private String[] lootPoolNames;
private double[] lootPoolChances;
private double lootGroupChance;
@@ -1,80 +1,263 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* 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 <http://www.gnu.org/licenses/>.
*
* 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.objectives;
import java.util.Random;
import engine.resources.scene.Point3D;
import main.NGECore;
import resources.common.BountyListItem;
import resources.objects.creature.CreatureObject;
import resources.objects.mission.MissionObject;
import services.mission.MissionObjective;
public class BountyMissionObjective extends MissionObjective {
private Point3D lastKnownLocation;
private long markObjId;
public BountyMissionObjective(MissionObject parent) {
super(parent);
}
@Override
public void activate(NGECore core, CreatureObject player) {
if (isActivated())
return;
BountyListItem bountyTarget = core.missionService.getBountyListItem(getMissionObject().getBountyObjId());
setMarkObjId(bountyTarget.getObjectId());
// TODO: Change this to a comm message.
player.sendSystemMessage("@mission/mission_bounty_informant:target_hard_" + Integer.toString(new Random().nextInt(5)), (byte) 0);
}
@Override
public void complete(NGECore core, CreatureObject player) {
}
@Override
public void abort(NGECore core, CreatureObject player) {
}
@Override
public void update(NGECore core, CreatureObject player) {
}
public Point3D getLastKnownLocation() { return lastKnownLocation; }
public void setLastKnownLocation(Point3D lastKnownLocation) { this.lastKnownLocation = lastKnownLocation; }
public long getMarkObjId() { return markObjId; }
public void setMarkObjId(long markObjId) { this.markObjId = markObjId; }
}
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* 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 <http://www.gnu.org/licenses/>.
*
* 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.objectives;
import java.util.Random;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import protocol.swg.CommPlayerMessage;
import engine.resources.container.Traverser;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Point3D;
import main.NGECore;
import resources.common.BountyListItem;
import resources.common.OutOfBand;
import resources.common.ProsePackage;
import resources.datatables.DisplayType;
import resources.objects.creature.CreatureObject;
import resources.objects.mission.MissionObject;
import resources.objects.waypoint.WaypointObject;
import services.chat.Mail;
import services.mission.MissionObjective;
public class BountyMissionObjective extends MissionObjective {
private Point3D lastKnownLocation;
private String lastKnownPlanet;
private ScheduledFuture<?> locationUpdater;
private long markObjId;
private boolean seekerActive = false;
private String seekerPlanet = "";
private boolean arakydActive = false;
public BountyMissionObjective(MissionObject parent) {
super(parent);
}
@Override
public void activate(NGECore core, CreatureObject player) {
if (isActivated())
return;
BountyListItem bountyTarget = core.missionService.getBountyListItem(getMissionObject().getBountyObjId());
if (bountyTarget == null) {
core.missionService.handleMissionAbort(player, getMissionObject());
player.sendSystemMessage("@bountyhunter:null_mission", DisplayType.Broadcast);
return;
}
bountyTarget.addBountyHunter(player.getObjectId());
setMarkObjId(bountyTarget.getObjectId());
String message = "@mission/mission_bounty_informant:target_hard_" + Integer.toString(new Random().nextInt(4) + 1);
CommPlayerMessage comm = new CommPlayerMessage(player.getObjectId(), new OutOfBand(new ProsePackage(message)));
comm.setTime(5000);
switch (bountyTarget.getFaction()) {
case "neutral":
comm.setModel("object/mobile/shared_dressed_assassin_mission_giver_0" + Integer.toString(new Random().nextInt(2) + 1) + ".iff");
break;
case "rebel":
comm.setModel("object/mobile/shared_dressed_assassin_mission_giver_imp_hum_m_0" + Integer.toString(new Random().nextInt(2) + 1) + ".iff");
break;
case "imperial":
comm.setModel("object/mobile/shared_dressed_assassin_mission_giver_reb_0" + Integer.toString(new Random().nextInt(2) + 1) + ".iff");
break;
} //Could also be: object/mobile/shared_bounty_guild_bounty_check.iff || object/mobile/shared_bounty_check_fugitive_x.iff
player.getClient().getSession().write(comm.serialize());
}
@Override
public void complete(NGECore core, CreatureObject player) {
BountyListItem bounty = core.missionService.getBountyListItem(markObjId);
if (bounty == null)
return;
int reward = getMissionObject().getCreditReward();
if (bounty.getCreditReward() - reward == 0)
player.addBankCredits(reward);
else
player.addBankCredits(bounty.getCreditReward());
notifyBountyPlacers(core, player, bounty);
clearActiveMissions(core, bounty);
core.missionService.removeBounty(markObjId);
}
@Override
public void abort(NGECore core, CreatureObject player) {
BountyListItem bounty = core.missionService.getBountyListItem(markObjId);
if (bounty == null)
return;
bounty.removeBountyHunter(player.getObjectId());
}
@Override
public void update(NGECore core, CreatureObject player) {
}
public void notifyBountyPlacers(NGECore core, CreatureObject player, BountyListItem bounty) {
String message = "Dear Sir or Madam,\nThe Galactic Bounty Network wishes to inform you that the bounty that you placed on the head of "+ bounty.getName()
+ " has been claimed by the bounty hunter, " + player.getCustomName() + ".\nThank you for your patronage, and have a nice day.";
bounty.getBountyPlacers().forEach(id -> {
Mail bountyMail = new Mail();
bountyMail.setMailId(core.chatService.generateMailId());
bountyMail.setTimeStamp((int) (new java.util.Date().getTime() / 1000));
bountyMail.setRecieverId(id);
bountyMail.setSubject("Bounty Claim Notification");
bountyMail.setSenderName("Galactic Bounty Network");
bountyMail.setMessage(message);
bountyMail.setStatus(Mail.NEW);
core.chatService.storePersistentMessage(bountyMail);
SWGObject obj = core.objectService.getObject(id);
if (obj != null)
core.chatService.sendPersistentMessageHeader(obj.getClient(), bountyMail);
});
}
public void clearActiveMissions(NGECore core, BountyListItem bounty) {
bounty.getAssignedHunters().forEach(id -> {
CreatureObject hunter = (CreatureObject) core.objectService.getObject(id);
if (hunter != null) {
hunter.sendSystemMessage(new OutOfBand(new ProsePackage("@bounty_hunter:bounty_failed_hunter", "TT", getMissionObject().getGrandparent().getObjectId())), DisplayType.Broadcast);
hunter.getSlottedObject("datapad").viewChildren(hunter, true, false, new Traverser() {
@Override
public void process(SWGObject item) {
if (item instanceof MissionObject) {
MissionObject mission = (MissionObject) item;
if (mission.getMissionType().equals("bounty")) {
core.missionService.handleMissionAbort(hunter, mission);
}
}
}
});
}
});
}
public void checkBountyActiveStatus(NGECore core) {
BountyListItem bountyTarget = core.missionService.getBountyListItem(getMissionObject().getBountyObjId());
CreatureObject player = (CreatureObject) getMissionObject().getGrandparent();
if (bountyTarget == null || !bountyTarget.getAssignedHunters().contains(player.getObjectId())) {
player.sendSystemMessage("@bounty_hunter:bounty_incomplete", DisplayType.Broadcast);
core.missionService.handleMissionAbort(player, getMissionObject(), true);
}
}
public void beginSeekerUpdates(NGECore core) {
if (!seekerActive) {
setSeekerActive(true);
setSeekerPlanet(getMissionObject().getGrandparent().getPlanet().getName());
ScheduledFuture<?> updates = Executors.newScheduledThreadPool(1).scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
MissionObject mission = getMissionObject();
SWGObject target = core.objectService.getObject(markObjId);
CreatureObject player = (CreatureObject) mission.getGrandparent();
if (target == null) {
player.sendSystemMessage("@mission/mission_generic:player_target_inactive", DisplayType.Broadcast);
cancelLocationUpdates();
return;
} else if (target.getPlanet().getName() != getSeekerPlanet()) {
player.sendSystemMessage("@mission/mission_generic:target_not_on_planet", DisplayType.Broadcast);
cancelLocationUpdates();
return;
} else {
WaypointObject missionWp = mission.getAttachedWaypoint();
if (missionWp == null) {
player.sendSystemMessage("@mission/mission_generic:target_not_found_1", DisplayType.Broadcast);
cancelLocationUpdates();
return;
}
missionWp.setPosition(target.getWorldPosition());
mission.setAttachedWaypoint(missionWp);
player.sendSystemMessage("@mission/mission_generic:target_location_updated_ground", DisplayType.Broadcast);
}
}
}, 60, 15, TimeUnit.SECONDS);
setLocationUpdater(updates);
}
}
public void cancelLocationUpdates() {
getLocationUpdater().cancel(true);
setSeekerActive(false);
setSeekerPlanet("");
setArakydActive(false);
}
public Point3D getLastKnownLocation() { return lastKnownLocation; }
public void setLastKnownLocation(Point3D lastKnownLocation) { this.lastKnownLocation = lastKnownLocation; }
public long getMarkObjId() { return markObjId; }
public void setMarkObjId(long markObjId) { this.markObjId = markObjId; }
public String getLastKnownPlanet() { return lastKnownPlanet; }
public void setLastKnownPlanet(String lastKnownPlanet) { this.lastKnownPlanet = lastKnownPlanet; }
public ScheduledFuture<?> getLocationUpdater() { return locationUpdater; }
public void setLocationUpdater(ScheduledFuture<?> locationUpdater) { this.locationUpdater = locationUpdater; }
public boolean isSeekerActive() { return seekerActive; }
public void setSeekerActive(boolean seekerActive) { this.seekerActive = seekerActive; }
public boolean isArakydActive() { return arakydActive; }
public void setArakydActive(boolean araykdActive) { this.arakydActive = araykdActive; }
public String getSeekerPlanet() { return seekerPlanet; }
public void setSeekerPlanet(String seekerPlanet) { this.seekerPlanet = seekerPlanet; }
}
+5 -3
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -33,12 +34,13 @@ import com.sleepycat.persist.model.Persistent;
import resources.common.StringUtilities;
@Persistent
public abstract class Delta implements IDelta {
public abstract class Delta implements IDelta, Serializable {
private static final long serialVersionUID = 1L;
@NotPersistent
protected final Object objectMutex = new Object();
protected transient final Object objectMutex = new Object();
@NotPersistent
private static SimpleBufferAllocator bufferPool = new SimpleBufferAllocator();
private transient static SimpleBufferAllocator bufferPool = new SimpleBufferAllocator();
public Delta() {
+3 -1
View File
@@ -21,10 +21,12 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
@Persistent
public interface IDelta {
public interface IDelta {
public byte[] getBytes();
+5 -3
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Collection;
@@ -43,16 +44,17 @@ import com.sleepycat.persist.model.Persistent;
/* A SWGList element MUST implement IDelta, or it will refuse to work with it */
@Persistent
public class SWGList<E> implements List<E> {
public class SWGList<E> implements List<E>, Serializable {
private static final long serialVersionUID = 1L;
private List<E> list = new ArrayList<E>();
@NotPersistent
private int updateCounter = 1;
private transient int updateCounter = 1;
private ObjectMessageBuilder messageBuilder;
private byte viewType;
private short updateType;
@NotPersistent
protected final Object objectMutex = new Object();
protected transient final Object objectMutex = new Object();
public SWGList() { }
+5 -3
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Collection;
@@ -43,16 +44,17 @@ import com.sleepycat.persist.model.Persistent;
@SuppressWarnings("unused")
@Persistent
public class SWGMap<K, V> implements Map<K, V> {
public class SWGMap<K, V> implements Map<K, V>, Serializable {
private static final long serialVersionUID = 1L;
private Map<K, V> map = new TreeMap<K, V>();
@NotPersistent
private int updateCounter = 0;
private transient int updateCounter = 0;
private ObjectMessageBuilder messageBuilder;
private byte viewType;
private short updateType;
@NotPersistent
protected final Object objectMutex = new Object();
protected transient final Object objectMutex = new Object();
public SWGMap() { }
+5 -3
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Collection;
@@ -46,16 +47,17 @@ import com.sleepycat.persist.model.Persistent;
@SuppressWarnings("unused")
@Persistent
public class SWGMultiMap<K, V> implements Multimap<K, V> {
public class SWGMultiMap<K, V> implements Multimap<K, V>, Serializable {
private static final long serialVersionUID = 1L;
private Multimap<K, V> map = ArrayListMultimap.create();
@NotPersistent
private int updateCounter = 0;
private transient int updateCounter = 0;
private ObjectMessageBuilder messageBuilder;
private byte viewType;
private short updateType;
@NotPersistent
protected final Object objectMutex = new Object();
protected transient final Object objectMutex = new Object();
public SWGMultiMap() { }
@@ -21,11 +21,13 @@
******************************************************************************/
package resources.objects.building;
import java.io.Serializable;
import java.util.Vector;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import main.NGECore;
import resources.objects.cell.CellMessageBuilder;
import resources.objects.cell.CellObject;
import resources.objects.creature.CreatureObject;
@@ -44,12 +46,13 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Entity(version=6)
public class BuildingObject extends TangibleObject implements IPersistent {
public class BuildingObject extends TangibleObject implements IPersistent, Serializable {
private static final long serialVersionUID = 1L;
@NotPersistent
private BuildingMessageBuilder messageBuilder;
private transient BuildingMessageBuilder messageBuilder;
@NotPersistent
private Transaction txn;
private transient Transaction txn;
private float maintenanceAmount = 0;
private int BMR = 0;
@@ -262,4 +265,10 @@ public class BuildingObject extends TangibleObject implements IPersistent {
return cells;
}
@Override
public void initAfterDBLoad() {
super.init();
messageBuilder = new BuildingMessageBuilder(this);
}
}
+12 -2
View File
@@ -21,10 +21,13 @@
******************************************************************************/
package resources.objects.cell;
import java.io.Serializable;
import protocol.swg.UpdateCellPermissionMessage;
import com.sleepycat.persist.model.NotPersistent;
import com.sleepycat.persist.model.Persistent;
import engine.clients.Client;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
@@ -32,11 +35,12 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=0)
public class CellObject extends SWGObject {
public class CellObject extends SWGObject implements Serializable {
private static final long serialVersionUID = 1L;
private int cellNumber = 0;
@NotPersistent
private CellMessageBuilder messageBuilder;
private transient CellMessageBuilder messageBuilder;
public CellObject() {
super();
@@ -80,5 +84,11 @@ public class CellObject extends SWGObject {
}
@Override
public void initAfterDBLoad() {
super.init();
messageBuilder = new CellMessageBuilder(this);
}
}
@@ -21,7 +21,12 @@
******************************************************************************/
package resources.objects.craft;
import java.io.Serializable;
import resources.objects.building.BuildingMessageBuilder;
import com.sleepycat.persist.model.Persistent;
import engine.clients.Client;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
@@ -29,9 +34,10 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent
public class DraftSchematic extends SWGObject {
public class DraftSchematic extends SWGObject implements Serializable {
private static final long serialVersionUID = 1L;
public DraftSchematic(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){
super(objectID, planet, position, orientation, template);
}
@@ -42,5 +48,11 @@ public class DraftSchematic extends SWGObject {
}
@Override
public void initAfterDBLoad() {
super.init();
}
}
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.creature;
import java.io.Serializable;
import java.lang.System;
import java.util.ArrayList;
import java.util.Collections;
@@ -62,23 +63,23 @@ import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
import resources.objects.building.BuildingMessageBuilder;
import resources.objects.player.PlayerObject;
import resources.objects.tangible.TangibleObject;
import resources.skills.SkillMod;
import services.command.BaseSWGCommand;
@Entity(version=9)
public class CreatureObject extends TangibleObject implements IPersistent {
public class CreatureObject extends TangibleObject implements Serializable {
@NotPersistent
private Transaction txn;
private static final long serialVersionUID = 1L;
// CREO 1
private int bankCredits = 0;
private int cashCredits = 0;
private List<String> skills;
@NotPersistent
private int skillsUpdateCounter = 0;
private transient int skillsUpdateCounter = 0;
// CREO 3
private byte posture = 0;
@@ -105,7 +106,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
private SWGList<MissionCriticalObject> missionCriticalObjects;
@NotPersistent
private int missionCriticalObjectsUpdateCounter = 0;
private transient int missionCriticalObjectsUpdateCounter = 0;
// CREO6
@@ -130,30 +131,30 @@ public class CreatureObject extends TangibleObject implements IPersistent {
private boolean acceptBandflourishes = true;
private boolean groupDance = true;
@NotPersistent
private CreatureObject performanceWatchee;
private transient CreatureObject performanceWatchee;
@NotPersistent
private CreatureObject performanceListenee;
private transient CreatureObject performanceListenee;
@NotPersistent
private Vector<CreatureObject> performanceAudience = new Vector<CreatureObject>();
private transient Vector<CreatureObject> performanceAudience = new Vector<CreatureObject>();
private int health = 1000;
private int action = 300;
@NotPersistent
private int HAMListCounter = 0;
private transient int HAMListCounter = 0;
private int maxHealth = 1000;
private int maxAction = 300;
@NotPersistent
private int maxHAMListCounter = 0;
private transient int maxHAMListCounter = 0;
private SWGList<SWGObject> equipmentList;
@NotPersistent
private int equipmentListUpdateCounter = 0;
private transient int equipmentListUpdateCounter = 0;
private SWGList<Buff> buffList = new SWGList<Buff>();
@NotPersistent
private int buffListUpdateCounter = 0;
private transient int buffListUpdateCounter = 0;
private byte difficulty = 0;
private SWGList<SWGObject> appearanceEquipmentList;
@NotPersistent
private int appearanceEquipmentListUpdateCounter = 0;
private transient int appearanceEquipmentListUpdateCounter = 0;
private boolean inStealth = false;
private boolean radarVisible = true; // radar
@@ -161,36 +162,36 @@ public class CreatureObject extends TangibleObject implements IPersistent {
// non-baseline vars
@NotPersistent
private List<CreatureObject> duelList = Collections.synchronizedList(new ArrayList<CreatureObject>());
private transient List<CreatureObject> duelList = Collections.synchronizedList(new ArrayList<CreatureObject>());
@NotPersistent
private CreatureMessageBuilder messageBuilder;
private transient CreatureMessageBuilder messageBuilder;
private SWGList<DamageOverTime> dotList = new SWGList<DamageOverTime>();
@NotPersistent
private ScheduledFuture<?> incapTask;
private transient ScheduledFuture<?> incapTask;
@NotPersistent
private ScheduledFuture<?> entertainerExperience;
private transient ScheduledFuture<?> entertainerExperience;
@NotPersistent
private ScheduledFuture<?> inspirationTick;
private transient ScheduledFuture<?> inspirationTick;
@NotPersistent
private ScheduledFuture<?> spectatorTask;
private transient ScheduledFuture<?> spectatorTask;
private boolean staticNPC = false; // temp
@NotPersistent
private int flourishCount = 0;
private transient int flourishCount = 0;
@NotPersistent
private boolean performingEffect;
private transient boolean performingEffect;
@NotPersistent
private boolean performingFlourish;
private transient boolean performingFlourish;
private int coverCharge;
@NotPersistent
private TangibleObject conversingNpc;
private transient TangibleObject conversingNpc;
@NotPersistent
private ConcurrentHashMap<String, Long> cooldowns = new ConcurrentHashMap<String, Long>();
private transient ConcurrentHashMap<String, Long> cooldowns = new ConcurrentHashMap<String, Long>();
@NotPersistent
private long tefTime = System.currentTimeMillis();
private transient long tefTime = System.currentTimeMillis();
@NotPersistent
private SWGObject useTarget;
private transient SWGObject useTarget;
public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
super(objectID, planet, Template, position, orientation);
@@ -210,6 +211,12 @@ public class CreatureObject extends TangibleObject implements IPersistent {
messageBuilder = new CreatureMessageBuilder(this);
}
@Override
public void initAfterDBLoad() {
super.init();
messageBuilder = new CreatureMessageBuilder(this);
}
private void loadTemplateData() {
/*if(getTemplateData().getAttribute("scale") != null)
@@ -228,10 +235,6 @@ public class CreatureObject extends TangibleObject implements IPersistent {
notifyObservers(messageBuilder.buildCustomNameDelta(customName), true);
}
public Transaction getTransaction() { return txn; }
public void createTransaction(Environment env) { txn = env.beginTransaction(null, null); }
public int getBankCredits() {
synchronized(objectMutex) {
@@ -21,11 +21,11 @@
******************************************************************************/
package resources.objects.factorycrate;
import java.io.Serializable;
import java.util.Map;
import java.util.Vector;
import main.NGECore;
import protocol.swg.SceneCreateObjectByCrc;
import protocol.swg.SceneDestroyObject;
import protocol.swg.SceneEndBaselines;
@@ -41,7 +41,7 @@ import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
import resources.objects.creature.CreatureMessageBuilder;
import resources.objects.creature.CreatureObject;
import resources.objects.tangible.TangibleObject;
@@ -50,8 +50,10 @@ import resources.objects.tangible.TangibleObject;
*/
@Persistent(version=0)
public class FactoryCrateObject extends TangibleObject {
public class FactoryCrateObject extends TangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
private Vector<TangibleObject> contents;
private byte capacity;
private byte contentObjectQuantity;
@@ -59,12 +61,19 @@ public class FactoryCrateObject extends TangibleObject {
private TangibleObject contentObjectType;
@NotPersistent
private FactoryCrateMessageBuilder messageBuilder;
private transient FactoryCrateMessageBuilder messageBuilder;
public FactoryCrateObject() {
}
@Override
public void initAfterDBLoad() {
super.init();
messageBuilder = new FactoryCrateMessageBuilder(this);
}
public FactoryCrateObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) {
super(objectID, planet, template, position, orientation);
this.messageBuilder = new FactoryCrateMessageBuilder(this);
+1 -1
View File
@@ -21,10 +21,10 @@
******************************************************************************/
package resources.objects.group;
import java.io.Serializable;
import java.util.Vector;
import resources.objects.universe.UniverseObject;
import engine.clients.Client;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Point3D;
+12 -12
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.guild;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
@@ -28,7 +29,6 @@ import java.util.TreeMap;
import org.apache.mina.core.buffer.IoBuffer;
import main.NGECore;
import resources.gcw.CurrentServerGCWZoneHistory;
import resources.gcw.CurrentServerGCWZonePercent;
import resources.gcw.OtherServerGCWZonePercent;
@@ -36,6 +36,7 @@ import resources.guild.Guild;
import resources.objects.SWGList;
import resources.objects.SWGMap;
import resources.objects.SWGMultiMap;
import resources.objects.cell.CellMessageBuilder;
import resources.objects.universe.UniverseObject;
import services.collections.ServerFirst;
@@ -51,16 +52,15 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Entity(version=1)
public class GuildObject extends UniverseObject implements IPersistent {
public class GuildObject extends UniverseObject implements Serializable {
private static final long serialVersionUID = 1L;
protected NGECore core;
@NotPersistent
private GuildMessageBuilder messageBuilder = new GuildMessageBuilder(this);
private transient GuildMessageBuilder messageBuilder = new GuildMessageBuilder(this);
private Map<String, ServerFirst> serverFirst = new HashMap<String, ServerFirst>();
private Map<String, Map<String, CurrentServerGCWZonePercent>> zoneMap = new TreeMap<String, Map<String, CurrentServerGCWZonePercent>>();
@NotPersistent
private Transaction txn;
private long nextInstanceId = 0;
@@ -91,6 +91,13 @@ public class GuildObject extends UniverseObject implements IPersistent {
this.core = core;
}
@Override
public void initAfterDBLoad() {
super.init();
messageBuilder = new GuildMessageBuilder(this);
}
public float getComplexity() {
synchronized(objectMutex) {
return complexity;
@@ -302,12 +309,5 @@ public class GuildObject extends UniverseObject implements IPersistent {
}
}
public Transaction getTransaction() {
return txn;
}
public void createTransaction(Environment env) {
txn = env.beginTransaction(null, null);
}
}
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.harvester;
import java.io.Serializable;
import java.util.Vector;
import main.NGECore;
@@ -32,6 +33,7 @@ import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
import resources.objects.creature.CreatureObject;
import resources.objects.guild.GuildMessageBuilder;
import resources.objects.installation.InstallationMessageBuilder;
import resources.objects.installation.InstallationObject;
import resources.objects.resource.GalacticResource;
@@ -42,8 +44,10 @@ import resources.objects.resource.ResourceContainerObject;
*/
@Persistent(version=0)
public class HarvesterObject extends InstallationObject {
public class HarvesterObject extends InstallationObject implements Serializable {
private static final long serialVersionUID = 1L;
private HarvesterMessageBuilder messageBuilder;
private InstallationMessageBuilder installationMessageBuilder;
@@ -128,6 +132,13 @@ public class HarvesterObject extends InstallationObject {
public int getBER() {
return BER;
}
@Override
public void initAfterDBLoad() {
super.init();
messageBuilder = new HarvesterMessageBuilder(this);
installationMessageBuilder = new InstallationMessageBuilder((InstallationObject)this);
}
public void setBER(int baseExtractionRate) {
@@ -21,17 +21,22 @@
******************************************************************************/
package resources.objects.installation;
import java.io.Serializable;
import com.sleepycat.persist.model.Entity;
import engine.clients.Client;
import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
import resources.objects.cell.CellMessageBuilder;
import resources.objects.tangible.TangibleObject;
@Entity(version=0)
public class InstallationObject extends TangibleObject {
public class InstallationObject extends TangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
public InstallationObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){
super(objectID, planet, template, position, orientation);
}
@@ -40,4 +45,10 @@ public class InstallationObject extends TangibleObject {
public void sendBaselines(Client destination) {
}
@Override
public void initAfterDBLoad() {
super.init();
}
}
@@ -21,6 +21,10 @@
******************************************************************************/
package resources.objects.intangible;
import java.io.Serializable;
import resources.objects.cell.CellMessageBuilder;
import com.sleepycat.persist.model.Persistent;
import engine.clients.Client;
@@ -30,8 +34,10 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=0)
public class IntangibleObject extends SWGObject {
public class IntangibleObject extends SWGObject implements Serializable {
private static final long serialVersionUID = 1L;
private int genericInt;
public IntangibleObject() {
@@ -42,6 +48,11 @@ public class IntangibleObject extends SWGObject {
super(objectID, planet, position, orientation, Template);
}
@Override
public void initAfterDBLoad() {
super.init();
}
public int getGenericInt() {
synchronized(objectMutex) {
return genericInt;
@@ -22,8 +22,13 @@
package resources.objects.manufacture;
import java.io.Serializable;
import resources.objects.cell.CellMessageBuilder;
import resources.objects.intangible.IntangibleObject;
import com.sleepycat.persist.model.Persistent;
import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@@ -34,8 +39,9 @@ import engine.resources.scene.Quaternion;
*/
@Persistent(version=0)
public class ManufactureSchematicObject extends IntangibleObject{
public class ManufactureSchematicObject extends IntangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
//@NotPersistent
//private ManufactureSchematicMessageBuilder messageBuilder;
@@ -44,4 +50,11 @@ public class ManufactureSchematicObject extends IntangibleObject{
//messageBuilder = new ManufactureSchematicMessageBuilder(this);
}
@Override
public void initAfterDBLoad() {
super.init();
//messageBuilder = new ManufactureSchematicMessageBuilder(this);
}
}
@@ -21,12 +21,15 @@
******************************************************************************/
package resources.objects.mission;
import java.io.Serializable;
import com.sleepycat.je.Environment;
import com.sleepycat.je.Transaction;
import com.sleepycat.persist.model.NotPersistent;
import com.sleepycat.persist.model.Persistent;
import resources.common.BountyListItem;
import resources.objects.cell.CellMessageBuilder;
import resources.objects.intangible.IntangibleObject;
import resources.objects.waypoint.WaypointObject;
import services.mission.MissionObjective;
@@ -37,8 +40,9 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=1)
public class MissionObject extends IntangibleObject implements IPersistent {
public class MissionObject extends IntangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
private Point3D destination;
private Point3D startLocation;
private String startPlanet = "";
@@ -60,11 +64,8 @@ public class MissionObject extends IntangibleObject implements IPersistent {
private long bountyObjId;
@NotPersistent
MissionMessageBuilder messageBuilder = new MissionMessageBuilder(this);
@NotPersistent
private Transaction txn;
private transient MissionMessageBuilder messageBuilder = new MissionMessageBuilder(this);
public MissionObject() {
super();
}
@@ -78,6 +79,12 @@ public class MissionObject extends IntangibleObject implements IPersistent {
return destinationPlanet;
}
}
@Override
public void initAfterDBLoad() {
super.init();
messageBuilder = new MissionMessageBuilder(this);
}
public int getMissionLevel() {
synchronized(objectMutex) {
@@ -306,14 +313,6 @@ public class MissionObject extends IntangibleObject implements IPersistent {
this.bountyObjId = bountyObjId;
}
public Transaction getTransaction() {
return txn;
}
public void createTransaction(Environment env) {
txn = env.beginTransaction(null, null);
}
@Override
public void sendBaselines(Client destination) {
+19 -10
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.player;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.HashMap;
@@ -32,6 +33,7 @@ import resources.objects.intangible.IntangibleObject;
import resources.objects.resource.ResourceContainerObject;
import resources.objects.tool.SurveyTool;
import resources.objects.waypoint.WaypointObject;
import resources.objects.cell.CellMessageBuilder;
import resources.objects.creature.CreatureObject;
import com.sleepycat.persist.model.NotPersistent;
@@ -45,8 +47,9 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=13)
public class PlayerObject extends IntangibleObject {
public class PlayerObject extends IntangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
// PLAY 3
private String title;
@@ -71,11 +74,11 @@ public class PlayerObject extends IntangibleObject {
private Map<String, Integer> xpList = new HashMap<String, Integer>();
@NotPersistent
private int xpListUpdateCounter = 0;
private transient int xpListUpdateCounter = 0;
private List<WaypointObject> waypoints = new ArrayList<WaypointObject>();
@NotPersistent
private int waypointListUpdateCounter = 0;
private transient int waypointListUpdateCounter = 0;
private int currentForcePower = 0; // unused in NGE
private int maxForcePower = 0; // unused in NGE
@@ -85,7 +88,7 @@ public class PlayerObject extends IntangibleObject {
private List<Quest> questJournal = new ArrayList<Quest>();
@NotPersistent
private int questJournalUpdateCounter = 0;
private transient int questJournalUpdateCounter = 0;
private String professionWheelPosition;
@@ -97,17 +100,17 @@ public class PlayerObject extends IntangibleObject {
private List<DraftSchematic> draftSchematicList = new ArrayList<DraftSchematic>();
@NotPersistent
private int draftSchematicListUpdateCounter = 0;
private transient int draftSchematicListUpdateCounter = 0;
private int experimentationPoints = 0;
private int accomplishmentCounter = 0;
private List<String> friendList = new ArrayList<String>();
@NotPersistent
private int friendListUpdateCounter = 0;
private transient int friendListUpdateCounter = 0;
private List<String> ignoreList = new ArrayList<String>();
@NotPersistent
private int ignoreListUpdateCounter = 0;
private transient int ignoreListUpdateCounter = 0;
private int languageId = 0; // unused in NGE
private int currentStomach = 0; // unused in NGE
@@ -129,10 +132,10 @@ public class PlayerObject extends IntangibleObject {
private int lotsRemaining = 10;
@NotPersistent
private PlayerMessageBuilder messageBuilder;
private transient PlayerMessageBuilder messageBuilder;
@NotPersistent
private long lastPlayTimeUpdate = System.currentTimeMillis();
private transient long lastPlayTimeUpdate = System.currentTimeMillis();
private Map<String, Integer> factionStandingMap = new TreeMap<String, Integer>();
@@ -145,7 +148,7 @@ public class PlayerObject extends IntangibleObject {
private List<Integer> chatChannels = new ArrayList<Integer>();
@NotPersistent
private boolean callingCompanion = false;
private transient boolean callingCompanion = false;
public PlayerObject() {
super();
@@ -156,6 +159,12 @@ public class PlayerObject extends IntangibleObject {
super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 0, 0), "object/player/shared_player.iff");
messageBuilder = new PlayerMessageBuilder(this);
}
@Override
public void initAfterDBLoad() {
super.init();
messageBuilder = new PlayerMessageBuilder(this);
}
public String getTitle() {
synchronized(objectMutex) {
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.resource;
import java.io.Serializable;
import java.util.List;
import java.util.Random;
import java.util.Vector;
@@ -28,6 +29,7 @@ import java.util.Vector;
import main.NGECore;
import protocol.swg.SurveyMapUpdateMessage;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerMessageBuilder;
import resources.objects.player.PlayerObject;
import resources.objects.waypoint.WaypointObject;
@@ -48,10 +50,9 @@ import engine.resources.scene.Quaternion;
*/
@Entity(version=0)
public class GalacticResource extends SWGObject implements IPersistent {
public class GalacticResource extends SWGObject implements Serializable {
@NotPersistent
private Transaction txn;
private static final long serialVersionUID = 1L;
private String name;
private String fileName;
@@ -63,30 +64,30 @@ public class GalacticResource extends SWGObject implements IPersistent {
@NotPersistent
public static final int INT_COLDRESISTANCE = 0;
public transient static final int INT_COLDRESISTANCE = 0;
@NotPersistent
public static final int INT_CONDUCTIVITY = 1;
public transient static final int INT_CONDUCTIVITY = 1;
@NotPersistent
public static final int INT_DECAYRESISTANCE = 2;
public transient static final int INT_DECAYRESISTANCE = 2;
@NotPersistent
public static final int INT_HEATRESISTANCE = 3;
public transient static final int INT_HEATRESISTANCE = 3;
@NotPersistent
public static final int INT_MALLEABILITY = 4;
public transient static final int INT_MALLEABILITY = 4;
@NotPersistent
public static final int INT_SHOCKRESISTANCE = 5;
public transient static final int INT_SHOCKRESISTANCE = 5;
@NotPersistent
public static final int INT_UNITTOUGHNESS = 6;
public transient static final int INT_UNITTOUGHNESS = 6;
@NotPersistent
public static final int INT_ENTANGLERESISTANCE = 7;
public transient static final int INT_ENTANGLERESISTANCE = 7;
@NotPersistent
public static final int INT_POTENTIALENERGY = 8;
public transient static final int INT_POTENTIALENERGY = 8;
@NotPersistent
public static final int INT_OVERALLQUALITY = 9;
public transient static final int INT_OVERALLQUALITY = 9;
@NotPersistent
public static final int INT_FLAVOR = 10;
public transient static final int INT_FLAVOR = 10;
@NotPersistent
public static final String[] statNamesLookup = {"Cold Resistance",
public transient static final String[] statNamesLookup = {"Cold Resistance",
"Conductivity",
"Decay Resistance",
"Heat Resistance",
@@ -117,22 +118,22 @@ public class GalacticResource extends SWGObject implements IPersistent {
short[] resourceStats = new short[11];
@NotPersistent
private static int RES_CAT_HI = 1; // Up to 99%, easy to find spots over 90%
private transient static int RES_CAT_HI = 1; // Up to 99%, easy to find spots over 90%
@NotPersistent
private static int RES_CAT_MID = 2; // Up to 90%, often have to settle at around 80%
private transient static int RES_CAT_MID = 2; // Up to 90%, often have to settle at around 80%
@NotPersistent
private static int RES_CAT_LO = 3; // Up to 70%, often have to settle around 60%
private transient static int RES_CAT_LO = 3; // Up to 70%, often have to settle around 60%
@NotPersistent
private static int RES_CAT_CRE = 4; // Creature resource
private transient static int RES_CAT_CRE = 4; // Creature resource
@NotPersistent // Direct Persistence Layer entity reference restriction
private ResourceRoot resourceRoot;
private transient ResourceRoot resourceRoot;
private int resourceRootID; // This is for re-referencing the resourceRoot in the reloaded resourceRoot collection
// due to the DPL entity reference restriction
@NotPersistent
private double minDist = 99999.0;
private transient double minDist = 99999.0;
public GalacticResource(){
@@ -148,6 +149,10 @@ public class GalacticResource extends SWGObject implements IPersistent {
this.id = id;
}
@Override
public void initAfterDBLoad() {
}
public GalacticResource(String name, String fileName, String category){
this.name = name;
this.fileName = fileName;
@@ -633,13 +638,6 @@ public class GalacticResource extends SWGObject implements IPersistent {
"zau"};
@Override
public void createTransaction(Environment env) { txn = env.beginTransaction(null, null);}
@Override
public Transaction getTransaction() { return txn; }
@Override
public void sendBaselines(Client arg0) {
}
@@ -1,12 +1,14 @@
package resources.objects.resource;
import java.io.Serializable;
import java.util.List;
import com.sleepycat.persist.model.Persistent;
@Persistent(version=0)
public class PlanetDeposits {
public class PlanetDeposits implements Serializable {
private static final long serialVersionUID = 1L;
private int planetId;
private List<ResourceDeposit> depositList;
@@ -22,6 +22,8 @@
package resources.objects.resource;
import java.io.Serializable;
import main.NGECore;
import com.sleepycat.persist.model.NotPersistent;
@@ -33,6 +35,7 @@ import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerMessageBuilder;
import resources.objects.tangible.TangibleObject;
/**
@@ -40,8 +43,9 @@ import resources.objects.tangible.TangibleObject;
*/
@Persistent(version=0)
public class ResourceContainerObject extends TangibleObject {
public class ResourceContainerObject extends TangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
// Unique ID
private long containerID;
@@ -131,20 +135,27 @@ public class ResourceContainerObject extends TangibleObject {
*/
@NotPersistent
public static int maximalStackCapacity = 100000;
public transient static int maximalStackCapacity = 100000;
@NotPersistent
private ResourceContainerMessageBuilder messageBuilder;
private transient ResourceContainerMessageBuilder messageBuilder;
public ResourceContainerObject(){
}
public ResourceContainerObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){
super(objectID, planet, template, position, orientation);
messageBuilder = new ResourceContainerMessageBuilder(this);
this.setAttachment("radial_filename", "resourceContainer");
}
}
@Override
public void initAfterDBLoad() {
super.init();
messageBuilder = new ResourceContainerMessageBuilder(this);
}
public void initializeStats(GalacticResource resource){
this.setResourceName(resource.getName());
@@ -1,5 +1,7 @@
package resources.objects.resource;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
/**
@@ -7,7 +9,9 @@ import com.sleepycat.persist.model.Persistent;
*/
@Persistent(version=0)
public class ResourceDeposit {
public class ResourceDeposit implements Serializable {
private static final long serialVersionUID = 1L;
private float spawnCoordsX;
private float spawnCoordsZ;
private float spawnRadius;
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.objects.resource;
import java.io.Serializable;
import com.sleepycat.je.Environment;
import com.sleepycat.je.Transaction;
import com.sleepycat.persist.model.Entity;
@@ -32,8 +34,9 @@ import com.sleepycat.persist.model.PrimaryKey;
*/
@Entity(version=0)
public class ResourceRoot {
public class ResourceRoot implements Serializable {
private static final long serialVersionUID = 1L;
// Publish 15:
// - Total: 61, Minimum pool: 15, Random pool: 24 (3 was removed), Fixed pool: 22.
@@ -84,7 +87,7 @@ public class ResourceRoot {
// All 38 Organic types for each planet
@NotPersistent
private Transaction txn;
private transient Transaction txn;
private static int highestID = 0;
+11 -1
View File
@@ -21,11 +21,21 @@
******************************************************************************/
package resources.objects.ship;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
import resources.objects.resource.ResourceContainerMessageBuilder;
import resources.objects.tangible.TangibleObject;
@Persistent(version=0)
public class ShipObject extends TangibleObject {
public class ShipObject extends TangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
@Override
public void initAfterDBLoad() {
super.init();
}
}
@@ -21,6 +21,10 @@
******************************************************************************/
package resources.objects.staticobject;
import java.io.Serializable;
import resources.objects.resource.ResourceContainerMessageBuilder;
import com.sleepycat.persist.model.NotPersistent;
import com.sleepycat.persist.model.Persistent;
@@ -31,10 +35,11 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=0)
public class StaticObject extends SWGObject {
public class StaticObject extends SWGObject implements Serializable {
private static final long serialVersionUID = 1L;
@NotPersistent
private StaticMessageBuilder messageBuilder;
private transient StaticMessageBuilder messageBuilder;
public StaticObject() {
super();
@@ -60,4 +65,11 @@ public class StaticObject extends SWGObject {
}
@Override
public void initAfterDBLoad() {
super.init();
messageBuilder = new StaticMessageBuilder(this);
}
}
@@ -22,6 +22,7 @@
package resources.objects.tangible;
import java.io.ByteArrayOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -42,6 +43,7 @@ import resources.common.RGB;
import resources.datatables.Options;
import resources.loot.LootGroup;
import resources.objects.creature.CreatureObject;
import resources.objects.staticobject.StaticMessageBuilder;
import resources.visitors.IDManagerVisitor;
import com.sleepycat.persist.model.NotPersistent;
@@ -54,9 +56,10 @@ import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=13)
public class TangibleObject extends SWGObject {
@Persistent(version=12)
public class TangibleObject extends SWGObject implements Serializable {
private static final long serialVersionUID = 1L;
// TODO: Thread safety
protected int incapTimer = 10;
@@ -72,9 +75,9 @@ public class TangibleObject extends SWGObject {
protected String faction = ""; // Says you're "Imperial Special Forces" if it's 0 for some reason
protected int factionStatus = 0;
@NotPersistent
private Vector<TangibleObject> defendersList = new Vector<TangibleObject>(); // unused in packets but useful for the server
private transient Vector<TangibleObject> defendersList = new Vector<TangibleObject>(); // unused in packets but useful for the server
@NotPersistent
private TangibleMessageBuilder messageBuilder;
private transient TangibleMessageBuilder messageBuilder;
private int respawnTime = 0;
private Point3D spawnCoordinates = new Point3D(0, 0, 0);
@@ -83,13 +86,13 @@ public class TangibleObject extends SWGObject {
private List<LootGroup> lootGroups = new ArrayList<LootGroup>();
@NotPersistent
private boolean looted = false; // These 4 should not need to be persisted, since a looted corpse will get wiped with server restart
private transient boolean looted = false; // These 4 should not need to be persisted, since a looted corpse will get wiped with server restart
@NotPersistent
private boolean lootLock = false;
private transient boolean lootLock = false;
@NotPersistent
private boolean creditRelieved = false;
private transient boolean creditRelieved = false;
@NotPersistent
private boolean lootItem = false;
private transient boolean lootItem = false;
private boolean stackable = false;
private int stackCount = 1;
@@ -101,7 +104,7 @@ public class TangibleObject extends SWGObject {
private String serialNumber;
@NotPersistent
private TangibleObject killer = null;
private transient TangibleObject killer = null;
public TangibleObject(long objectID, Planet planet, String template) {
super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template);
@@ -121,6 +124,12 @@ public class TangibleObject extends SWGObject {
messageBuilder = new TangibleMessageBuilder(this);
}
@Override
public void initAfterDBLoad() {
super.init();
messageBuilder = new TangibleMessageBuilder(this);
}
public void setCustomName2(String customName) {
setCustomName(customName);
+20 -11
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.tool;
import java.io.Serializable;
import java.util.Vector;
import main.NGECore;
@@ -34,6 +35,7 @@ import engine.resources.scene.Quaternion;
import resources.objects.creature.CreatureObject;
import resources.objects.resource.GalacticResource;
import resources.objects.resource.ResourceConcentration;
import resources.objects.tangible.TangibleMessageBuilder;
import resources.objects.tangible.TangibleObject;
/**
@@ -41,8 +43,9 @@ import resources.objects.tangible.TangibleObject;
*/
@Persistent(version=0)
public class SurveyTool extends TangibleObject{
public class SurveyTool extends TangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
private byte toolType=0;
private long surveyResourceID;
private long userID=0;
@@ -50,25 +53,25 @@ public class SurveyTool extends TangibleObject{
private byte SurveyRangeSetting=0;
@NotPersistent
private String surveyEffectString="";
private transient String surveyEffectString="";
@NotPersistent
private String sampleEffectString="";
private transient String sampleEffectString="";
@NotPersistent
private boolean currentlySurveying=false;
private transient boolean currentlySurveying=false;
@NotPersistent
private boolean currentlySampling=false;
private transient boolean currentlySampling=false;
@NotPersistent
private boolean currentlyCoolingDown=false;
private transient boolean currentlyCoolingDown=false;
@NotPersistent
private boolean exceptionalState=false;
private transient boolean exceptionalState=false;
@NotPersistent
private boolean recoveryMode=false;
private transient boolean recoveryMode=false;
@NotPersistent
private Long lastSurveyTime=0L;
private transient Long lastSurveyTime=0L;
@NotPersistent
private Long lastSampleTime=0L;
private transient Long lastSampleTime=0L;
@NotPersistent
private Long recoveryTime=10L;
private transient Long recoveryTime=10L;
public static byte MineralSurveyDevice = 1;
public static byte ChemicalSurveyDevice = 2;
@@ -84,6 +87,12 @@ public class SurveyTool extends TangibleObject{
this.exceptionalState = false;
}
@Override
public void initAfterDBLoad() {
super.init();
this.exceptionalState = false;
}
public SurveyTool(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){
super(objectID, planet, template, position, orientation);
surveyEffectString = "";
@@ -21,6 +21,10 @@
******************************************************************************/
package resources.objects.universe;
import java.io.Serializable;
import resources.objects.tangible.TangibleMessageBuilder;
import com.sleepycat.persist.model.Persistent;
import engine.clients.Client;
@@ -30,8 +34,10 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=0)
public class UniverseObject extends SWGObject {
public class UniverseObject extends SWGObject implements Serializable {
private static final long serialVersionUID = 1L;
public UniverseObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
super(objectID, planet, position, orientation, Template);
}
@@ -39,6 +45,11 @@ public class UniverseObject extends SWGObject {
public UniverseObject() {
super();
}
@Override
public void initAfterDBLoad() {
super.init();
}
@Override
public void sendBaselines(Client arg0) {
@@ -21,7 +21,10 @@
******************************************************************************/
package resources.objects.waypoint;
import java.io.Serializable;
import resources.objects.intangible.IntangibleObject;
import resources.objects.tangible.TangibleMessageBuilder;
import com.sleepycat.persist.model.Persistent;
@@ -31,8 +34,10 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=0)
public class WaypointObject extends IntangibleObject {
public class WaypointObject extends IntangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
private int cellId; // ???
private long locationNetworkId;
private int planetCRC;
@@ -54,6 +59,11 @@ public class WaypointObject extends IntangibleObject {
super(objectID, planet, position, new Quaternion(0, 0, 0, 1), "object/waypoint/shared_waypoint.iff");
}
@Override
public void initAfterDBLoad() {
super.init();
}
public int getCellId() {
synchronized(objectMutex) {
return cellId;
+13 -3
View File
@@ -21,7 +21,10 @@
******************************************************************************/
package resources.objects.weapon;
import java.io.Serializable;
import resources.datatables.WeaponType;
import resources.objects.tangible.TangibleMessageBuilder;
import resources.objects.tangible.TangibleObject;
import com.sleepycat.persist.model.NotPersistent;
@@ -33,12 +36,14 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=1)
public class WeaponObject extends TangibleObject {
public class WeaponObject extends TangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
// TODO: Thread safety
@NotPersistent
private WeaponMessageBuilder messageBuilder;
private transient WeaponMessageBuilder messageBuilder;
public WeaponObject(long objectID, Planet planet, String template) {
super(objectID, planet, template, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0));
@@ -53,12 +58,17 @@ public class WeaponObject extends TangibleObject {
if (this.getClass().getSimpleName().equals("WeaponObject")) setIntAttribute("volume", 1);
setStringAttribute("cat_wpn_damage.damage", "0-0");
}
public WeaponObject() {
super();
messageBuilder = new WeaponMessageBuilder(this);
}
@Override
public void initAfterDBLoad() {
super.init();
messageBuilder = new WeaponMessageBuilder(this);
}
public int getIncapTimer() {
return incapTimer;
+5 -1
View File
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.skills;
import java.io.Serializable;
import org.apache.mina.core.buffer.IoBuffer;
import resources.objects.Delta;
@@ -28,8 +30,10 @@ import resources.objects.Delta;
import com.sleepycat.persist.model.Persistent;
@Persistent(version=0)
public class SkillMod extends Delta {
public class SkillMod extends Delta implements Serializable {
private static final long serialVersionUID = 1L;
private int base;
private int modifier;
+2 -7
View File
@@ -269,10 +269,7 @@ public class CharacterService implements INetworkDispatch {
core.skillModService.addSkillMod(object, "language_basic_speak", 100);
core.skillModService.addSkillMod(object, "creature_harvesting", 25);
core.skillModService.addSkillMod(object, "language_wookiee_comprehend", 100);
object.createTransaction(core.getCreatureODB().getEnvironment());
PlayerObject player = (PlayerObject) core.objectService.createObject("object/player/shared_player.iff", object.getPlanet());
object._add(player);
core.skillService.addSkill(object, "species_" + object.getStfName());
@@ -334,9 +331,7 @@ public class CharacterService implements INetworkDispatch {
createStarterClothing(object, sharedRaceTemplate, clientCreateCharacter.getStarterProfession());
//core.scriptService.callScript("scripts/", "demo", "CreateStartingCharacter", core, object);
core.getCreatureODB().put(object, Long.class, CreatureObject.class, object.getTransaction());
// might not need to commit transaction but better safe than sorry
object.getTransaction().commitSync();
core.getSWGObjectODB().put(object.getObjectID(), object);
PreparedStatement ps = databaseConnection.preparedStatement("INSERT INTO characters (id, \"firstName\", \"lastName\", \"accountId\", \"galaxyId\", \"statusId\", appearance, gmflag) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
ps.setLong(1, object.getObjectID());
+2 -4
View File
@@ -270,7 +270,7 @@ public class ConnectionService implements INetworkDispatch {
}
}*/
core.missionService.getBountyList().remove(core.getBountiesODB().get(object.getObjectId(), Long.class, BountyListItem.class));
core.missionService.getBountyList().remove(core.getBountiesODB().get(object.getObjectId()));
ghost.toggleFlag(PlayerFlags.LD);
@@ -283,9 +283,7 @@ public class ConnectionService implements INetworkDispatch {
schedulers.clear();
core.playerService.getSchedulers().remove(object.getObjectID());
object.createTransaction(core.getCreatureODB().getEnvironment());
core.getCreatureODB().put(object, Long.class, CreatureObject.class, object.getTransaction());
object.getTransaction().commitSync();
core.getSWGObjectODB().put(object.getObjectID(), object);
core.objectService.destroyObject(object);
}
+5
View File
@@ -91,6 +91,7 @@ public class DevService implements INetworkDispatch {
if(creature.getClient().isGM()) suiOptions.put((long) 120, "House Deeds");
if(creature.getClient().isGM()) suiOptions.put((long) 125, "Crafting Tools");
if(creature.getClient().isGM()) suiOptions.put((long) 130, "Vehicle Deeds");
if(creature.getClient().isGM()) suiOptions.put((long) 121, "Sandbox City");
break;
case 3: // [Items] Weapons
@@ -1176,6 +1177,10 @@ public class DevService implements INetworkDispatch {
inventory.add(deed);
return;
case 121:
NGECore.getInstance().playerCityService.buildSandboxTestCity(player);
case 125:
TangibleObject genericCraftingTool = (TangibleObject) core.objectService.createObject("object/tangible/crafting/station/shared_generic_tool.iff", planet);
genericCraftingTool.setCustomName("Generic Crafting Tool");
+1 -1
View File
@@ -206,7 +206,7 @@ public class LoginService implements INetworkDispatch{
core.objectService.destroyObject(object);
}
core.getCreatureODB().delete(new Long(packet.getcharId()), Long.class, CreatureObject.class);
core.getSWGObjectODB().remove(object.getObjectID());
DeleteCharacterReplyMessage reply = new DeleteCharacterReplyMessage(0);
session.write(reply.serialize());
}
+34 -8
View File
@@ -1282,25 +1282,51 @@ public class PlayerService implements INetworkDispatch {
}
public void sendSetBountyWindow(final CreatureObject victim, final CreatureObject attacker) {
SUIWindow bountyWindow = core.suiService.createInputBox(InputBoxType.INPUT_BOX_OK_CANCEL, "@bounty_hunter:setbounty_title", "@bounty_hunter:setbounty_prompt1 " + attacker.getCustomName() + "?" + "\n@bounty_hunter:setbounty_prompt2 " + victim.getBankCredits(),
victim, null, (float) 10, new SUICallback() {
SUIWindow bountyWindow = core.suiService.createInputBox(InputBoxType.INPUT_BOX_OK_CANCEL, "@bounty_hunter:setbounty_title", "@bounty_hunter:setbounty_prompt1 " + attacker.getCustomName() + "?" + "\n@bounty_hunter:setbounty_prompt2 "
+ String.valueOf(victim.getBankCredits() + victim.getCashCredits()), victim, null, (float) 10, new SUICallback() {
@Override
public void process(SWGObject owner, int eventType, Vector<String> returnList) {
if (eventType == 0 && returnList.get(0) != null) {
int bounty = Integer.parseInt(returnList.get(0));
int totalFunds = victim.getBankCredits() + victim.getCashCredits();
if (bounty > victim.getBankCredits())
if (bounty > totalFunds) {
victim.sendSystemMessage("@bounty_hunter:setbounty_too_much", DisplayType.Broadcast);
sendSetBountyWindow(victim, attacker);
return;
if (!core.missionService.addToExistingBounty(attacker, bounty))
core.missionService.createNewBounty(attacker, bounty);
victim.setBankCredits(victim.getBankCredits() - bounty);
}
if (bounty < 20000) {
victim.sendSystemMessage("@bounty_hunter:setbounty_too_little", DisplayType.Broadcast);
sendSetBountyWindow(victim, attacker);
return;
} else if (bounty > 1000000) {
victim.sendSystemMessage("@bounty_hunter:setbounty_cap", DisplayType.Broadcast);
bounty = 1000000;
}
// Try removing bounty amount from the bank first then cash. Remove amount accordingly if bank/cash is less than placed bounty.
if (bounty > victim.getBankCredits()) {
int difference = bounty - victim.getBankCredits();
victim.setCashCredits(victim.getCashCredits() - difference);
victim.setBankCredits(0);
} else if (bounty > victim.getCashCredits()) {
int difference = bounty - victim.getCashCredits();
victim.setBankCredits(victim.getBankCredits() - difference);
victim.setCashCredits(0);
} else { victim.setBankCredits(victim.getBankCredits() - bounty); }
if (!core.missionService.addToExistingBounty(attacker.getObjectId(), victim.getObjectId(), bounty))
core.missionService.createNewBounty(attacker, victim.getObjectId(), bounty);
}
}
});
bountyWindow.setProperty("txtInput:NumericInteger", "true");
bountyWindow.setProperty("txtInput:MaxLength", "7");
core.suiService.openSUIWindow(bountyWindow);
}
+5 -6
View File
@@ -53,6 +53,7 @@ import engine.resources.common.Event;
import engine.resources.common.Mesh3DTriangle;
import engine.resources.common.Ray;
import engine.resources.container.Traverser;
import engine.resources.database.ODBCursor;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
@@ -186,13 +187,11 @@ public class SimulationService implements INetworkDispatch {
}
public void insertPersistentBuildings() {
EntityCursor<BuildingObject> cursor = core.getBuildingODB().getCursor(Long.class, BuildingObject.class);
ODBCursor cursor = core.getSWGObjectODB().getCursor();
Iterator<BuildingObject> it = cursor.iterator();
while(it.hasNext()) {
final BuildingObject building = (BuildingObject) core.objectService.getObject(it.next().getObjectID());
if(building == null)
while(cursor.hasNext()) {
SWGObject building = core.objectService.getObject(((SWGObject) cursor.next()).getObjectID());
if(building == null || !(building instanceof BuildingObject))
continue;
if(building.getAttachment("hasLoadedServerTemplate") == null)
core.objectService.loadServerTemplate(building);
+6 -15
View File
@@ -21,6 +21,8 @@
******************************************************************************/
package services.bazaar;
import java.io.Serializable;
import com.sleepycat.je.Environment;
import com.sleepycat.je.Transaction;
import com.sleepycat.persist.model.Entity;
@@ -31,8 +33,10 @@ import engine.resources.objects.IPersistent;
import engine.resources.objects.SWGObject;
@Entity(version=1)
public class AuctionItem implements IPersistent, Comparable<AuctionItem> {
public class AuctionItem implements Comparable<AuctionItem>, Serializable {
private static final long serialVersionUID = 1L;
@PrimaryKey
private long objectId;
private SWGObject item;
@@ -62,10 +66,7 @@ public class AuctionItem implements IPersistent, Comparable<AuctionItem> {
public final static int EXPIRED = 4;
public final static int OFFERED = 5;
public final static int RETRIEVED = 6;
@NotPersistent
private Transaction txn;
public AuctionItem() {
}
@@ -256,16 +257,6 @@ public class AuctionItem implements IPersistent, Comparable<AuctionItem> {
this.auctionOptions = auctionOptions;
}
@Override
public void createTransaction(Environment env) {
txn = env.beginTransaction(null, null);
}
@Override
public Transaction getTransaction() {
return txn;
}
public SWGObject getItem() {
return item;
}
+14 -11
View File
@@ -38,6 +38,7 @@ import com.sleepycat.persist.EntityCursor;
import main.NGECore;
import engine.clients.Client;
import engine.resources.database.ODBCursor;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
@@ -81,16 +82,18 @@ public class BazaarService implements INetworkDispatch {
public BazaarService(NGECore core) {
this.core = core;
loadAuctionItems();
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
System.out.println("Saving auction items...");
auctionItems.forEach(item -> core.objectService.persistObject(item, Long.class, AuctionItem.class, core.getAuctionODB()));
}));
}
public void saveAllItems() {
System.out.println("Saving auction items...");
auctionItems.forEach(item -> core.objectService.persistObject(item.getObjectId(), item, core.getAuctionODB()));
}
private void loadAuctionItems() {
EntityCursor<AuctionItem> cursor = core.getAuctionODB().getCursor(Long.class, AuctionItem.class);
Iterator<AuctionItem> it = cursor.iterator();
it.forEachRemaining(this::addAuctionItem);
ODBCursor cursor = core.getAuctionODB().getCursor();
while(cursor.hasNext()) {
addAuctionItem((AuctionItem) cursor.next());
}
cursor.close();
}
@@ -412,7 +415,7 @@ public class BazaarService implements INetworkDispatch {
if(seller == null) {
seller = core.objectService.getCreatureFromDB(item.getOwnerId());
seller.setBankCredits(seller.getBankCredits() + item.getPrice());
core.objectService.persistObject(seller, Long.class, CreatureObject.class, core.getAuctionODB());
core.objectService.persistObject(seller.getObjectID(), seller, core.getSWGObjectODB());
}
}
@@ -752,8 +755,8 @@ public class BazaarService implements INetworkDispatch {
if(commodityLimit.get(auctionItem.getOwnerId()) != null)
commodityNumber = commodityLimit.get(auctionItem.getOwnerId());
commodityLimit.put(auctionItem.getOwnerId(), commodityNumber + 1);
if(!core.getAuctionODB().contains(auctionItem.getObjectId(), Long.class, AuctionItem.class)) {
core.objectService.persistObject(auctionItem, Long.class, AuctionItem.class, core.getAuctionODB());
if(!core.getAuctionODB().contains(auctionItem.getObjectId())) {
core.objectService.persistObject(auctionItem.getObjectId(), auctionItem, core.getAuctionODB());
}
}
@@ -763,7 +766,7 @@ public class BazaarService implements INetworkDispatch {
if(commodityLimit.get(auctionItem.getOwnerId()) != null)
commodityNumber = commodityLimit.get(auctionItem.getOwnerId());
commodityLimit.put(auctionItem.getOwnerId(), commodityNumber - 1);
core.objectService.deletePersistentObject(auctionItem, Long.class, AuctionItem.class, core.getAuctionODB(), auctionItem.getObjectId());
core.objectService.deletePersistentObject(auctionItem.getObjectId(), core.getAuctionODB());
}
}
+6 -2
View File
@@ -21,15 +21,19 @@
******************************************************************************/
package services.chat;
import java.io.Serializable;
import java.util.Vector;
import com.sleepycat.persist.model.Entity;
import com.sleepycat.persist.model.NotPersistent;
import com.sleepycat.persist.model.PrimaryKey;
@Entity(version=1)
public class ChatRoom {
public class ChatRoom implements Serializable {
private static final long serialVersionUID = 1L;
private String creator; // creator of the room (first name only, lowercase)
private String description; // title
@PrimaryKey
@@ -39,7 +43,7 @@ public class ChatRoom {
private Vector<String> moderatorList = new Vector<String>();
private Vector<String> banList = new Vector<String>();
@NotPersistent
private Vector<String> userList = new Vector<String>(); // current users
private transient Vector<String> userList = new Vector<String>(); // current users
private boolean moderatorsOnly;
private boolean privateRoom;
+19 -20
View File
@@ -42,6 +42,7 @@ import engine.clientdata.visitors.DatatableVisitor;
import engine.clients.Client;
import engine.resources.config.Config;
import engine.resources.config.DefaultConfig;
import engine.resources.database.ODBCursor;
import engine.resources.database.ObjectDatabase;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
@@ -317,7 +318,7 @@ public class ChatService implements INetworkDispatch {
return;
SWGObject obj = client.getParent();
Mail mail = mailODB.get(new Integer(packet.getMailId()), Integer.class, Mail.class);
Mail mail = (Mail) mailODB.get((long) packet.getMailId());
if(obj == null || mail == null)
return;
@@ -352,7 +353,7 @@ public class ChatService implements INetworkDispatch {
return;
SWGObject obj = client.getParent();
Mail mail = mailODB.get(new Integer(packet.getMailId()), Integer.class, Mail.class);
Mail mail = (Mail) mailODB.get((long) packet.getMailId());
if(obj == null || mail == null)
return;
@@ -689,15 +690,11 @@ public class ChatService implements INetworkDispatch {
public void storePersistentMessage(Mail mail) {
Transaction txn = mailODB.getEnvironment().beginTransaction(null, null);
mailODB.put(mail, Integer.class, Mail.class, txn);
txn.commitSync();
mailODB.put((long) mail.getMailId(), mail);
}
public void deletePersistentMessage(Mail mail) {
Transaction txn = mailODB.getEnvironment().beginTransaction(null, null);
mailODB.delete(new Integer(mail.getMailId()), Integer.class, Mail.class, txn);
txn.commitSync();
mailODB.remove((long) mail.getMailId());
}
public void loadMailHeaders(Client client) {
@@ -707,14 +704,16 @@ public class ChatService implements INetworkDispatch {
if(obj == null || client.getSession() == null)
return;
EntityCursor<Mail> cursor = mailODB.getCursor(Integer.class, Mail.class);
ODBCursor cursor = mailODB.getCursor();
for(Mail mail : cursor) {
while(cursor.hasNext()) {
Mail mail = (Mail) cursor.next();
if(mail.getRecieverId() == obj.getObjectID()) {
sendPersistentMessageHeader(client, mail);
}
}
cursor.close();
}
@@ -747,7 +746,7 @@ public class ChatService implements INetworkDispatch {
int id = rand.nextInt();
if(mailODB.contains(new Integer(id), Integer.class, Mail.class))
if(mailODB.contains((long) id))
return generateMailId();
else
return id;
@@ -755,7 +754,7 @@ public class ChatService implements INetworkDispatch {
public Mail getMailById(int mailId) {
Mail mail = mailODB.get(new Integer(mailId), Integer.class, Mail.class);
Mail mail = (Mail) mailODB.get((long) mailId);
return mail;
}
@@ -776,7 +775,7 @@ public class ChatService implements INetworkDispatch {
Random rand = new Random();
int id = rand.nextInt();
if (chatRoomsODB.contains(new Integer(id), Integer.class, ChatRoom.class))
if (chatRoomsODB.contains((long) id))
return generateChatRoomId();
else
return id;
@@ -819,11 +818,13 @@ public class ChatService implements INetworkDispatch {
createChatRoom("Politician chat for this galaxy", "Politician", "system", true);
//createChatRoom("Pilot chat for this galaxy", "Pilot", "system", true);
EntityCursor<ChatRoom> cursor = chatRoomsODB.getCursor(Integer.class, ChatRoom.class);
cursor.forEach(room -> {
ODBCursor cursor = chatRoomsODB.getCursor();
while(cursor.hasNext()) {
ChatRoom room = (ChatRoom) cursor.next();
if (!chatRooms.containsValue(room))
chatRooms.put(room.getRoomId(), room);
});
}
cursor.close();
List<Planet> planets = core.terrainService.getPlanetList();
@@ -891,9 +892,7 @@ public class ChatService implements INetworkDispatch {
chatRooms.put(room.getRoomId(), room);
if(store){
Transaction txn = chatRoomsODB.getEnvironment().beginTransaction(null, null);
chatRoomsODB.put(room, Integer.class, ChatRoom.class, txn);
txn.commitSync();
chatRoomsODB.put((long) room.getRoomId(), room);
}
//Console.println("Created room " + address + " with ID " + room.getRoomId());
+7 -2
View File
@@ -21,13 +21,18 @@
******************************************************************************/
package services.chat;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import com.sleepycat.persist.model.Entity;
import com.sleepycat.persist.model.PrimaryKey;
@Entity(version=1)
public class Mail {
public class Mail implements Serializable {
private static final long serialVersionUID = 1L;
@PrimaryKey
private int mailId;
private String senderName;
@@ -36,7 +41,7 @@ public class Mail {
private String message;
private byte status;
private int timeStamp;
private List<WaypointAttachment> attachments;
private List<WaypointAttachment> attachments = new ArrayList<WaypointAttachment>();
public static final byte NEW = 0x4E;
public static final byte READ = 0x52;
+5 -1
View File
@@ -21,11 +21,15 @@
******************************************************************************/
package services.chat;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
@Persistent
public class WaypointAttachment {
public class WaypointAttachment implements Serializable {
private static final long serialVersionUID = 1L;
public WaypointAttachment() { }
public long cellID;

Some files were not shown because too many files have changed in this diff Show More