diff --git a/.classpath b/.classpath
new file mode 100644
index 00000000..6f03bb31
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
index 0f182a03..b59b5fc8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,190 @@
+#################
+## Eclipse
+#################
+
+*.pydevproject
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.pkc
+*.swp
+*~.nib
+local.properties
+.settings/
+.loadpath
+*.ltn
+*.pln
+*.lsb
+pt_sword_glint
+*.lod
+*.msh
+*.mesh
+*.iff
+*.pob
+*.ws
+*.trn
+*.tga
+*.lmg
+*.sat
+*.lay
+*.flr
+*.apt
+*.prt
+*.cfg
+*.spr
+*.swh
+*.jdb
+*.lck
+*.mgn
+*.0
+cachedir/
+appearance/
*.class
-# Package Files #
-*.jar
-*.war
-*.ear
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+
+#################
+## Visual Studio
+#################
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Rr]elease/
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.vspscc
+.builds
+*.dotCover
+
+## TODO: If you have NuGet Package Restore enabled, uncomment this
+#packages/
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+
+# Visual Studio profiler
+*.psess
+*.vsp
+
+# ReSharper is a .NET coding add-in
+_ReSharper*
+
+# Installshield output folder
+[Ee]xpress
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish
+
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+*.Cache
+ClientBin
+stylecop.*
+~$*
+*.dbmdl
+Generated_Code #added for RIA/Silverlight projects
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+
+
+
+############
+## Windows
+############
+
+# Windows image file caches
+Thumbs.db
+
+# Folder config file
+Desktop.ini
+
+
+#############
+## Python
+#############
+
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
+
+# Mac crap
+.DS_Store
diff --git a/.project b/.project
new file mode 100644
index 00000000..5c73c250
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
+
+
+ NGECore2
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/lib/MINA/mina-core-2.0.4.jar b/lib/MINA/mina-core-2.0.4.jar
new file mode 100644
index 00000000..1e7ba38e
Binary files /dev/null and b/lib/MINA/mina-core-2.0.4.jar differ
diff --git a/lib/MINA/mina-example-2.0.4.jar b/lib/MINA/mina-example-2.0.4.jar
new file mode 100644
index 00000000..a32014c4
Binary files /dev/null and b/lib/MINA/mina-example-2.0.4.jar differ
diff --git a/lib/MINA/mina-filter-compression-2.0.4.jar b/lib/MINA/mina-filter-compression-2.0.4.jar
new file mode 100644
index 00000000..3db65710
Binary files /dev/null and b/lib/MINA/mina-filter-compression-2.0.4.jar differ
diff --git a/lib/MINA/mina-integration-beans-2.0.4.jar b/lib/MINA/mina-integration-beans-2.0.4.jar
new file mode 100644
index 00000000..68c5bb6b
Binary files /dev/null and b/lib/MINA/mina-integration-beans-2.0.4.jar differ
diff --git a/lib/MINA/mina-integration-jmx-2.0.4.jar b/lib/MINA/mina-integration-jmx-2.0.4.jar
new file mode 100644
index 00000000..3bf096a2
Binary files /dev/null and b/lib/MINA/mina-integration-jmx-2.0.4.jar differ
diff --git a/lib/MINA/mina-integration-ognl-2.0.4.jar b/lib/MINA/mina-integration-ognl-2.0.4.jar
new file mode 100644
index 00000000..120c4101
Binary files /dev/null and b/lib/MINA/mina-integration-ognl-2.0.4.jar differ
diff --git a/lib/MINA/mina-integration-xbean-2.0.4.jar b/lib/MINA/mina-integration-xbean-2.0.4.jar
new file mode 100644
index 00000000..0e97a0f5
Binary files /dev/null and b/lib/MINA/mina-integration-xbean-2.0.4.jar differ
diff --git a/lib/MINA/mina-statemachine-2.0.4.jar b/lib/MINA/mina-statemachine-2.0.4.jar
new file mode 100644
index 00000000..56e21837
Binary files /dev/null and b/lib/MINA/mina-statemachine-2.0.4.jar differ
diff --git a/lib/MINA/mina-transport-apr-2.0.4.jar b/lib/MINA/mina-transport-apr-2.0.4.jar
new file mode 100644
index 00000000..0a7983cc
Binary files /dev/null and b/lib/MINA/mina-transport-apr-2.0.4.jar differ
diff --git a/lib/commons-collections-3.1.jar b/lib/commons-collections-3.1.jar
new file mode 100644
index 00000000..41e230fe
Binary files /dev/null and b/lib/commons-collections-3.1.jar differ
diff --git a/lib/commons-io-2.2.jar b/lib/commons-io-2.2.jar
new file mode 100644
index 00000000..84ca5658
Binary files /dev/null and b/lib/commons-io-2.2.jar differ
diff --git a/lib/commons-math3-3.0.jar b/lib/commons-math3-3.0.jar
new file mode 100644
index 00000000..ff84bd29
Binary files /dev/null and b/lib/commons-math3-3.0.jar differ
diff --git a/lib/commons-pool-1.6.jar b/lib/commons-pool-1.6.jar
new file mode 100644
index 00000000..72ca75a3
Binary files /dev/null and b/lib/commons-pool-1.6.jar differ
diff --git a/lib/hemesh/apfloat.jar b/lib/hemesh/apfloat.jar
new file mode 100644
index 00000000..bd8d1653
Binary files /dev/null and b/lib/hemesh/apfloat.jar differ
diff --git a/lib/hemesh/hemesh.jar b/lib/hemesh/hemesh.jar
new file mode 100644
index 00000000..b6446b47
Binary files /dev/null and b/lib/hemesh/hemesh.jar differ
diff --git a/lib/hemesh/javolution-5.5.1.jar b/lib/hemesh/javolution-5.5.1.jar
new file mode 100644
index 00000000..7ac80ea9
Binary files /dev/null and b/lib/hemesh/javolution-5.5.1.jar differ
diff --git a/lib/hemesh/jts.jar b/lib/hemesh/jts.jar
new file mode 100644
index 00000000..00c27ad6
Binary files /dev/null and b/lib/hemesh/jts.jar differ
diff --git a/lib/hemesh/quickhull3d.jar b/lib/hemesh/quickhull3d.jar
new file mode 100644
index 00000000..632df52a
Binary files /dev/null and b/lib/hemesh/quickhull3d.jar differ
diff --git a/lib/je-5.0.58.jar b/lib/je-5.0.58.jar
new file mode 100644
index 00000000..cd2b3e37
Binary files /dev/null and b/lib/je-5.0.58.jar differ
diff --git a/lib/jython-2.5.4-rc1.jar b/lib/jython-2.5.4-rc1.jar
new file mode 100644
index 00000000..b5dec857
Binary files /dev/null and b/lib/jython-2.5.4-rc1.jar differ
diff --git a/lib/log4j-1.2.16.jar b/lib/log4j-1.2.16.jar
new file mode 100644
index 00000000..3f9d8476
Binary files /dev/null and b/lib/log4j-1.2.16.jar differ
diff --git a/lib/mbassador-1.0.7.RC-20121229.133808-1.jar b/lib/mbassador-1.0.7.RC-20121229.133808-1.jar
new file mode 100644
index 00000000..c8ce6059
Binary files /dev/null and b/lib/mbassador-1.0.7.RC-20121229.133808-1.jar differ
diff --git a/lib/mysql-connector-java-5.1.22-bin.jar b/lib/mysql-connector-java-5.1.22-bin.jar
new file mode 100644
index 00000000..a50424d6
Binary files /dev/null and b/lib/mysql-connector-java-5.1.22-bin.jar differ
diff --git a/lib/postgresql-9.1-902.jdbc4.jar b/lib/postgresql-9.1-902.jdbc4.jar
new file mode 100644
index 00000000..078f3793
Binary files /dev/null and b/lib/postgresql-9.1-902.jdbc4.jar differ
diff --git a/lib/slf4j-api-1.6.1.jar b/lib/slf4j-api-1.6.1.jar
new file mode 100644
index 00000000..f1f4fdd2
Binary files /dev/null and b/lib/slf4j-api-1.6.1.jar differ
diff --git a/lib/slf4j-log4j12-1.6.4.jar b/lib/slf4j-log4j12-1.6.4.jar
new file mode 100644
index 00000000..daa3aa16
Binary files /dev/null and b/lib/slf4j-log4j12-1.6.4.jar differ
diff --git a/lib/toxiclibscore.jar b/lib/toxiclibscore.jar
new file mode 100644
index 00000000..24d5405a
Binary files /dev/null and b/lib/toxiclibscore.jar differ
diff --git a/names.txt b/names.txt
new file mode 100644
index 00000000..d945c209
--- /dev/null
+++ b/names.txt
@@ -0,0 +1,87 @@
+-Ael
+-Aer
+-af
+-ah
+-am
+-ama
+-an
+-ang +v
+-ansr +v
+-dae +c
+-dho
+-eir
+-fi
+-fir
+-la
+-seh
+-sel
+-ev
+-fis
+-hu
+-ha
+-gar
+-gil
+-ka
+-kan
+-ya
+-za
+-zy
+-mara
+-mai +c
+-lue +c
+-ny
+-she
+-sum
+-syl
+ae +c -c
+ael -c
+dar
+der
+deth +v
+dre -v
+drim -v
+dul
+duk
+ean -c
+el
+emar
+eman
+hal
+har
+iat -c
+mah
+ten
+que -v +c
+ria
+rail
+ther
+thus
+thi
+san
++ael -c
++dar
++deth
++dre
++drim
++dul
++ean -c
++el
++emar
++nes
++nin
++oth
++hal
++iat
++mah
++ten
++ther
++thus
++thi
++ran
++ath
++ess
++san
++yth
++las
++lian
++evar
\ No newline at end of file
diff --git a/nge.backup b/nge.backup
new file mode 100644
index 00000000..049637b4
Binary files /dev/null and b/nge.backup differ
diff --git a/ngengine_public.jar b/ngengine_public.jar
new file mode 100644
index 00000000..8bba1a3f
Binary files /dev/null and b/ngengine_public.jar differ
diff --git a/odb/creature/placeholder.txt b/odb/creature/placeholder.txt
new file mode 100644
index 00000000..e69de29b
diff --git a/odb/mails/placeholder.txt b/odb/mails/placeholder.txt
new file mode 100644
index 00000000..e69de29b
diff --git a/scripts/commands/equip.py b/scripts/commands/equip.py
new file mode 100644
index 00000000..514fbb92
--- /dev/null
+++ b/scripts/commands/equip.py
@@ -0,0 +1,19 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+ parsedMsg = commandString.split(' ', 3)
+ objService = core.objectService
+ containerID = long(parsedMsg[1])
+ container = objService.getObject(containerID)
+ if target and container and target.getContainer():
+ print 'Equip Test'
+ oldContainer = target.getContainer()
+ oldContainer.transferTo(actor, container, target)
+
+ return
+
\ No newline at end of file
diff --git a/scripts/commands/giveitem.py b/scripts/commands/giveitem.py
new file mode 100644
index 00000000..5065d818
--- /dev/null
+++ b/scripts/commands/giveitem.py
@@ -0,0 +1,24 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+
+ if not commandString.startswith('object/tangible') and not commandString.startswith('object/weapon'):
+ return
+
+ object = core.objectService.createObject(commandString, actor.getPlanet())
+
+ if not object:
+ return
+
+ inventory = actor.getSlottedObject('inventory')
+
+ if inventory:
+ inventory.add(object)
+
+ return
+
\ No newline at end of file
diff --git a/scripts/commands/kneel.py b/scripts/commands/kneel.py
new file mode 100644
index 00000000..50a1d471
--- /dev/null
+++ b/scripts/commands/kneel.py
@@ -0,0 +1,13 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+ actor.setPosture(1)
+ actor.setSpeedMultiplierBase(0)
+ actor.setTurnRadius(0)
+ return
+
\ No newline at end of file
diff --git a/scripts/commands/object.py b/scripts/commands/object.py
new file mode 100644
index 00000000..f41424ea
--- /dev/null
+++ b/scripts/commands/object.py
@@ -0,0 +1,20 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+
+ if commandString.startswith('checklos') and target:
+ print 'test'
+ los = core.simulationService.checkLineOfSight(actor, target)
+ if not los:
+ actor.sendSystemMessage('-Cant see target-', 2)
+ else:
+ actor.sendSystemMessage('LOS ok', 2)
+
+
+ return
+
\ No newline at end of file
diff --git a/scripts/commands/opencontainer.py b/scripts/commands/opencontainer.py
new file mode 100644
index 00000000..52d33449
--- /dev/null
+++ b/scripts/commands/opencontainer.py
@@ -0,0 +1,13 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+ if target:
+ simService = core.simulationService
+ simService.openContainer(actor, target)
+ return
+
\ No newline at end of file
diff --git a/scripts/commands/prone.py b/scripts/commands/prone.py
new file mode 100644
index 00000000..e84832f5
--- /dev/null
+++ b/scripts/commands/prone.py
@@ -0,0 +1,13 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+ actor.setPosture(2)
+ actor.setSpeedMultiplierBase(0.25)
+ actor.setTurnRadius(1)
+ return
+
\ No newline at end of file
diff --git a/scripts/commands/serverdestroyobject.py b/scripts/commands/serverdestroyobject.py
new file mode 100644
index 00000000..6c55f9b1
--- /dev/null
+++ b/scripts/commands/serverdestroyobject.py
@@ -0,0 +1,28 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+
+ if not target:
+ return
+
+ print 'Destroy Test'
+
+ parent = target.getContainer()
+
+ if not target.getPermissions().canRemove(actor, target):
+ return
+ if parent and not parent.getPermissions().canRemove(actor, parent):
+ return
+ if not target.isSubChildOf(actor):
+ return
+
+ parent.remove(target)
+ core.objectService.destroyObject(target)
+
+ return
+
\ No newline at end of file
diff --git a/scripts/commands/sitserver.py b/scripts/commands/sitserver.py
new file mode 100644
index 00000000..5fbfce54
--- /dev/null
+++ b/scripts/commands/sitserver.py
@@ -0,0 +1,31 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+from protocol.swg.objectControllerObjects import SitOnObject
+from protocol.swg import ObjControllerMessage
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+
+ if len(commandString) > 0:
+ parsedMsg = commandString.split(',', 4)
+ x = float(parsedMsg[0])
+ y = float(parsedMsg[1])
+ z = float(parsedMsg[2])
+ cellId = long(parsedMsg[3])
+ sitOnObject = SitOnObject(x, y, z, cellId, actor.getObjectID())
+ objController = ObjControllerMessage(27, sitOnObject)
+ actor.notifyObservers(objController, True)
+ actor.setPosture(8)
+ actor.setStateBitmask(32768)
+ actor.setTurnRadius(0)
+ return
+
+ actor.setPosture(8)
+ actor.setSpeedMultiplierBase(0)
+ actor.setTurnRadius(0)
+
+ return
+
\ No newline at end of file
diff --git a/scripts/commands/socialinternal.py b/scripts/commands/socialinternal.py
new file mode 100644
index 00000000..24657d1b
--- /dev/null
+++ b/scripts/commands/socialinternal.py
@@ -0,0 +1,20 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+ chatService = core.chatService
+ parsedMsg = commandString.split(' ', 3)
+ targetId = long(parsedMsg[0])
+ target = core.objectService.getObject(targetId)
+ emoteId = int(parsedMsg[1])
+ chatService.handleEmote(actor, target, emoteId)
+
+ return
+
+
+
+
diff --git a/scripts/commands/spatialchatinternal.py b/scripts/commands/spatialchatinternal.py
new file mode 100644
index 00000000..1cb74f83
--- /dev/null
+++ b/scripts/commands/spatialchatinternal.py
@@ -0,0 +1,16 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+ parsedMsg = commandString.split(' ', 5)
+ chatService = core.chatService
+ chatMsg = parsedMsg[5]
+ chatType = int(parsedMsg[1])
+ moodId = int(parsedMsg[2])
+ chatService.handleSpatialChat(actor, target, chatMsg, chatType, moodId)
+ return
+
\ No newline at end of file
diff --git a/scripts/commands/stand.py b/scripts/commands/stand.py
new file mode 100644
index 00000000..3ef5a78c
--- /dev/null
+++ b/scripts/commands/stand.py
@@ -0,0 +1,18 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+
+ if actor.getStateBitmask() == 32768:
+ actor.setStateBitmask(0)
+
+ actor.setPosture(0)
+ actor.setSpeedMultiplierBase(1)
+ actor.setTurnRadius(1)
+
+ return
+
\ No newline at end of file
diff --git a/scripts/commands/transferitem.py b/scripts/commands/transferitem.py
new file mode 100644
index 00000000..8b548eba
--- /dev/null
+++ b/scripts/commands/transferitem.py
@@ -0,0 +1,19 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+ parsedMsg = commandString.split(' ', 3)
+ objService = core.objectService
+ containerID = long(parsedMsg[1])
+ container = objService.getObject(containerID)
+ if target and container and target.getContainer():
+ print 'Default Test'
+ oldContainer = target.getContainer()
+ oldContainer.transferTo(actor, container, target)
+
+ return
+
\ No newline at end of file
diff --git a/scripts/commands/transferitemarmor.py b/scripts/commands/transferitemarmor.py
new file mode 100644
index 00000000..d3ea91cd
--- /dev/null
+++ b/scripts/commands/transferitemarmor.py
@@ -0,0 +1,19 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+ parsedMsg = commandString.split(' ', 3)
+ objService = core.objectService
+ containerID = long(parsedMsg[1])
+ container = objService.getObject(containerID)
+ if target and container and target.getContainer():
+ print 'Armor Test'
+ oldContainer = target.getContainer()
+ oldContainer.transferTo(actor, container, target)
+
+ return
+
\ No newline at end of file
diff --git a/scripts/commands/transferitemmisc.py b/scripts/commands/transferitemmisc.py
new file mode 100644
index 00000000..eda077fa
--- /dev/null
+++ b/scripts/commands/transferitemmisc.py
@@ -0,0 +1,20 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+ parsedMsg = commandString.split(' ', 3)
+ objService = core.objectService
+ containerID = long(parsedMsg[1])
+ print str(containerID)
+ container = objService.getObject(containerID)
+ if target and container and target.getContainer():
+ print 'Misc Test'
+ oldContainer = target.getContainer()
+ oldContainer.transferTo(actor, container, target)
+
+ return
+
\ No newline at end of file
diff --git a/scripts/commands/transferitemweapon.py b/scripts/commands/transferitemweapon.py
new file mode 100644
index 00000000..b0b4027d
--- /dev/null
+++ b/scripts/commands/transferitemweapon.py
@@ -0,0 +1,19 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def setup():
+ return
+
+def run(core, actor, target, commandString):
+ parsedMsg = commandString.split(' ', 3)
+ objService = core.objectService
+ containerID = long(parsedMsg[1])
+ container = objService.getObject(containerID)
+ if target and container and target.getContainer():
+ print 'Weapon Test'
+ oldContainer = target.getContainer()
+ oldContainer.transferTo(actor, container, target)
+
+ return
+
\ No newline at end of file
diff --git a/scripts/demo.py b/scripts/demo.py
new file mode 100644
index 00000000..d51148fd
--- /dev/null
+++ b/scripts/demo.py
@@ -0,0 +1,20 @@
+import sys
+from resources.objects import SWGObject
+from main import NGECore
+
+def CreateStartingCharacter(core, object):
+
+ testObject = core.objectService.createObject('object/weapon/ranged/rifle/shared_rifle_t21.iff', object.getPlanet())
+ testObject.setCustomName('This is a Jython Rifle')
+ inventory = object.getSlottedObject('inventory')
+ inventory.add(testObject)
+
+ testClothing = core.objectService.createObject('object/tangible/wearables/cape/shared_cape_rebel_01.iff', object.getPlanet())
+ testClothing.setCustomName('Test Cape')
+ testCloak = core.objectService.createObject('object/tangible/wearables/robe/shared_robe_jedi_dark_s05.iff', object.getPlanet())
+ testCloak.setCustomName('Test Cloak')
+
+ inventory.add(testClothing)
+ inventory.add(testCloak)
+
+ return
diff --git a/src/main/NGECore.java b/src/main/NGECore.java
new file mode 100644
index 00000000..4730e624
--- /dev/null
+++ b/src/main/NGECore.java
@@ -0,0 +1,285 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package main;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
+import java.util.concurrent.ConcurrentHashMap;
+
+
+
+import resources.objects.creature.CreatureObject;
+import services.CharacterService;
+import services.ConnectionService;
+import services.LoginService;
+import services.MapService;
+import services.ScriptService;
+import services.SimulationService;
+import services.TerrainService;
+import services.chat.ChatService;
+import services.command.CommandService;
+import services.object.ObjectService;
+import services.object.UpdateService;
+import engine.clientdata.ClientFileManager;
+import engine.clientdata.visitors.CrcStringTableVisitor;
+import engine.clientdata.visitors.DatatableVisitor;
+import engine.clientdata.visitors.LevelOfDetailVisitor;
+import engine.clientdata.visitors.MeshVisitor;
+import engine.clientdata.visitors.PortalVisitor;
+import engine.clientdata.visitors.TerrainVisitor;
+import engine.clientdata.visitors.WorldSnapshotVisitor;
+import engine.clientdata.visitors.WorldSnapshotVisitor.SnapshotChunk;
+import engine.clients.Client;
+import engine.resources.common.PHPBB3Auth;
+import engine.resources.config.Config;
+import engine.resources.config.DefaultConfig;
+import engine.resources.database.DatabaseConnection;
+import engine.resources.database.ObjectDatabase;
+import engine.resources.objects.SWGObject;
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+import engine.resources.service.NetworkDispatch;
+import engine.servers.MINAServer;
+import engine.servers.PingServer;
+
+@SuppressWarnings("unused")
+
+public class NGECore {
+
+ public static boolean didServerCrash = false;
+
+ private Config config = null;
+
+
+ private ConcurrentHashMap clients = new ConcurrentHashMap();
+
+ // Database
+
+ private DatabaseConnection databaseConnection = null;
+ private DatabaseConnection databaseConnection2 = null;
+
+ // Services
+ public LoginService loginService;
+ public ConnectionService connectionService;
+ public CommandService commandService;
+ public CharacterService characterService;
+ public ObjectService objectService;
+ public MapService mapService;
+ public UpdateService updateService;
+ public TerrainService terrainService;
+ public SimulationService simulationService;
+ public ScriptService scriptService;
+ public ChatService chatService;
+
+
+ // Login Server
+ public NetworkDispatch loginDispatch;
+ private MINAServer loginServer;
+
+ // Zone Server
+ public NetworkDispatch zoneDispatch;
+ private MINAServer zoneServer;
+
+ private ObjectDatabase creatureODB;
+
+ private ObjectDatabase mailODB;
+
+
+ public NGECore() {
+
+ }
+
+ public void start() {
+ config = new Config();
+ config.setFilePath("nge.cfg");
+ if (!(config.loadConfigFile())) {
+ config = DefaultConfig.getConfig();
+ }
+
+ // Database
+ databaseConnection = new DatabaseConnection();
+ databaseConnection.connect(config.getString("DB.URL"), config.getString("DB.NAME"), config.getString("DB.USER"), config.getString("DB.PASS"), "postgresql");
+
+ databaseConnection2 = new DatabaseConnection();
+
+ creatureODB = new ObjectDatabase("creature", true, false, true);
+ mailODB = new ObjectDatabase("mails", true, false, true);
+
+ // Services
+ loginService = new LoginService(this);
+ connectionService = new ConnectionService(this);
+ characterService = new CharacterService(this);
+
+ objectService = new ObjectService(this);
+ terrainService = new TerrainService(this);
+ updateService = new UpdateService(this);
+ mapService = new MapService(this);
+ scriptService = new ScriptService(this);
+ commandService = new CommandService(this);
+ chatService = new ChatService(this);
+
+ // Ping Server
+ try {
+ PingServer pingServer = new PingServer(config.getInt("PING.PORT"));
+ pingServer.bind();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ // Login Server
+ loginDispatch = new NetworkDispatch(this, false);
+ loginDispatch.addService(loginService);
+
+ loginServer = new MINAServer(loginDispatch, config.getInt("LOGIN.PORT"));
+ loginServer.start();
+ // Zone Server
+ zoneDispatch = new NetworkDispatch(this, true);
+ zoneDispatch.addService(connectionService);
+ zoneDispatch.addService(characterService);
+ zoneDispatch.addService(objectService);
+ zoneDispatch.addService(commandService);
+ zoneDispatch.addService(chatService);
+
+ zoneServer = new MINAServer(zoneDispatch, config.getInt("ZONE.PORT"));
+ zoneServer.start();
+
+ // Planets
+ terrainService.addPlanet(1, "tatooine", "terrain/tatooine.trn", true);
+
+
+ terrainService.loadSnapShotObjects();
+ simulationService = new SimulationService(this);
+ zoneDispatch.addService(simulationService);
+
+ didServerCrash = false;
+ System.out.println("Started Server.");
+
+ }
+
+
+
+ public void stop() {
+ System.out.println("Stopping Servers and Connections.");
+ databaseConnection.close();
+ databaseConnection2.close();
+ }
+
+ public void cleanUp() {
+ System.out.println("Cleaning Up...");
+ long memoryUsed = Runtime.getRuntime().freeMemory();
+ System.out.println("Using " + memoryUsed + " bytes of memory.");
+
+ config = null;
+ databaseConnection = null;
+ databaseConnection2 = null;
+ Runtime.getRuntime().gc();
+ System.out.println("Cleaned Up " + (Runtime.getRuntime().freeMemory() - memoryUsed) + " bytes of memory.");
+ }
+
+ public void restart() {
+ stop();
+ cleanUp();
+ try {
+ Thread.sleep(30000);
+ } catch (InterruptedException e) {
+
+ }
+ start();
+ }
+
+ public static void main(String[] args) {
+
+ NGECore core = new NGECore();
+
+ core.start();
+
+ do {
+ if (didServerCrash) {
+ core.restart();
+ }
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+
+ }
+ } while (true);
+
+ }
+
+ /*
+ * ---------- Getter methods for NGECore ----------
+ */
+ public Config getConfig() {
+ return config;
+ }
+
+ public DatabaseConnection getDatabase1() {
+ return databaseConnection;
+ }
+
+ public DatabaseConnection getDatabase2() {
+ return databaseConnection2;
+ }
+
+ public ObjectDatabase getCreatureODB() {
+ return creatureODB;
+ }
+
+ public ObjectDatabase getMailODB() {
+ return mailODB;
+ }
+
+ public int getActiveClients() {
+ int connections = 0;
+ for (Map.Entry c : clients.entrySet()) {
+ if(c.getValue().getSession() != null) {
+ if (c.getValue().getSession().isConnected()) {
+ connections++;
+ }
+ }
+ }
+ return connections;
+ }
+
+ public Client getClient(int connectionID) {
+ return clients.get(connectionID);
+ }
+
+ public ConcurrentHashMap getActiveConnectionsMap() {
+ return clients;
+ }
+
+ /*
+ * --------------- Other methods for services ---------------
+ */
+ public void addClient(Integer connectionID, Client client) {
+ clients.put(connectionID, client);
+ }
+
+ public void removeClient(Integer connectionID) {
+ clients.remove(connectionID);
+ }
+
+
+}
+
diff --git a/src/protocol/Message.java b/src/protocol/Message.java
new file mode 100644
index 00000000..5085a975
--- /dev/null
+++ b/src/protocol/Message.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+public abstract class Message {
+
+ protected byte[] data;
+ protected int opcode;
+ protected short sequence;
+ protected IoBuffer result;
+
+ public Message() {
+
+ }
+
+ public Message(byte[] data) {
+ this.data = data;
+ }
+
+ public int getOpcode() {
+ return opcode;
+ }
+
+ public int getSize() {
+ return (data == null) ? 0 : data.length;
+ }
+
+ public byte[] getData() {
+ return data == null ? new byte[] { } : data.clone();
+ }
+
+ public abstract void deserialize(IoBuffer data);
+ public abstract IoBuffer serialize();
+
+ protected String getAsciiString(IoBuffer buffer)
+ {
+ return getString(buffer, "US-ASCII");
+ }
+
+ protected String getUnicodeString(IoBuffer buffer)
+ {
+ return getString(buffer, "UTF-16LE");
+ }
+
+ protected byte[] getAsciiString(String string)
+ {
+ return getString(string, "US-ASCII");
+ }
+
+ protected byte[] getUnicodeString(String string)
+ {
+ return getString(string, "UTF-16LE");
+ }
+
+ protected String getString(IoBuffer buffer, String charFormat)
+ {
+
+ String result;
+
+ int length;
+
+ if (charFormat == "UTF-16LE") length = buffer.order(ByteOrder.LITTLE_ENDIAN).getInt();
+ else length = buffer.order(ByteOrder.LITTLE_ENDIAN).getShort();
+
+ int bufferPosition = buffer.position();
+
+ try
+ {
+
+ result = new String(buffer.array(), bufferPosition, length, charFormat);
+
+ }
+ catch (UnsupportedEncodingException e)
+ {
+
+ e.printStackTrace();
+ return "";
+
+ }
+
+ buffer.position(bufferPosition + length);
+
+ return result;
+
+ }
+ private byte[] getString(String string, String charFormat)
+ {
+
+ ByteBuffer result;
+ int length = 2 + string.length();
+
+ if (charFormat == "UTF-16LE")
+ {
+
+ result = ByteBuffer.allocate(length * 2).order(ByteOrder.LITTLE_ENDIAN);
+ result.putInt(string.length());
+
+ }
+ else
+ {
+
+ result = ByteBuffer.allocate(length).order(ByteOrder.LITTLE_ENDIAN);
+ result.putShort((short) string.length());
+
+ }
+
+ try
+ {
+
+ result.put(string.getBytes(charFormat));
+
+ }
+ catch (UnsupportedEncodingException e)
+ {
+
+ e.printStackTrace();
+ return new byte[] {};
+
+ }
+
+ return result.array();
+
+ }
+
+
+ /**
+ * Reads the next string in. It gets the length of the
+ * string from the short/int at the beginning of it
+ * @param bb The ByteBuffer to read from
+ * @param charset Charset of the string
+ * @return The read string. Returns "" if exception is thrown
+ */
+ protected String getNextString(IoBuffer bb, String charset) {
+ try {
+ int length = 0;
+ if (charset.equals("US-ASCII") || charset.equals("UTF-8")) {
+ length = bb.getShort();
+ } else {
+ length = bb.getInt();
+ }
+ if (length > bb.remaining())
+ return "";
+ byte [] data = new byte[length];
+ bb.get(data);
+ return new String(data, charset);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return "";
+ }
+
+ /**
+ * Reads the next array with specified size and returns it
+ * @param bb The ByteBuffer to read from
+ * @param size Size of the array
+ * @return The array that has been read, or an empty array if an exception
+ */
+ protected byte [] getNextArray(IoBuffer bb, int size) {
+ try {
+ if (bb.remaining() < size)
+ return new byte[0];
+ byte [] tmp = new byte[size];
+ bb.get(tmp);
+ return tmp;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return new byte[0];
+ }
+
+
+ protected String getNextAsciiString(IoBuffer buffer) {
+ return getNextString(buffer, "US-ASCII");
+ }
+ protected String getNextUnicodeString(IoBuffer buffer) {
+ return getNextString(buffer, "UTF-16LE");
+ }
+
+}
diff --git a/src/protocol/swg/AccountFeatureBits.java b/src/protocol/swg/AccountFeatureBits.java
new file mode 100644
index 00000000..1e89db13
--- /dev/null
+++ b/src/protocol/swg/AccountFeatureBits.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class AccountFeatureBits extends SWGMessage {
+
+ public AccountFeatureBits() {
+
+ operandCount = 2;
+ opcode = 0x979F0279;
+
+ data = new byte[] {
+ (byte)0x31, (byte)0x82, (byte)0x5C, (byte)0x02,
+ (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x06, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x8A, (byte)0xC0, (byte)0xEA, (byte)0x4E };
+
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(22).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort(operandCount);
+ result.putInt(opcode);
+ result.put(data);
+ result.flip();
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/CharacterCreationDisabled.java b/src/protocol/swg/CharacterCreationDisabled.java
new file mode 100644
index 00000000..3e3e261e
--- /dev/null
+++ b/src/protocol/swg/CharacterCreationDisabled.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class CharacterCreationDisabled extends SWGMessage {
+
+ private int creationDisabled;
+
+ public CharacterCreationDisabled(int creationDisabled) {
+ operandCount = 2;
+ opcode = 0xF4A15265;
+ this.creationDisabled = creationDisabled;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort(operandCount);
+ result.putInt(opcode);
+ result.putInt(creationDisabled);
+ result.flip();
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/ChatDeletePersistentMessage.java b/src/protocol/swg/ChatDeletePersistentMessage.java
new file mode 100644
index 00000000..1e812255
--- /dev/null
+++ b/src/protocol/swg/ChatDeletePersistentMessage.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ChatDeletePersistentMessage extends SWGMessage {
+
+ private int mailId;
+
+ @Override
+ public void deserialize(IoBuffer buffer) {
+
+ buffer.getShort();
+ buffer.getInt();
+ setMailId(buffer.getInt());
+
+ }
+
+ @Override
+ public IoBuffer serialize() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getMailId() {
+ return mailId;
+ }
+
+ public void setMailId(int mailId) {
+ this.mailId = mailId;
+ }
+
+}
diff --git a/src/protocol/swg/ChatInstantMessageToCharacter.java b/src/protocol/swg/ChatInstantMessageToCharacter.java
new file mode 100644
index 00000000..0e75b83f
--- /dev/null
+++ b/src/protocol/swg/ChatInstantMessageToCharacter.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ChatInstantMessageToCharacter extends SWGMessage {
+
+ private static final int maxdistance = 1000;
+ private String game;
+ private String galaxy;
+ private String recipient;
+ private String message;
+ private int sequence;
+
+ public ChatInstantMessageToCharacter() {
+
+ }
+
+ public void deserialize(IoBuffer buffer) {
+ buffer.getShort();
+ buffer.getInt();
+
+ int size;
+
+ try {
+ size = buffer.getShort();
+ game = new String(ByteBuffer.allocate(size).put(buffer.array(), buffer.position(), size).array(), "UTF8");
+ buffer.position(buffer.position() + size);
+
+ size = buffer.getShort();
+ galaxy = new String(ByteBuffer.allocate(size).put(buffer.array(), buffer.position(), size).array(), "US-ASCII");
+ buffer.position(buffer.position() + size);
+
+ size = buffer.getShort();
+ recipient = new String(ByteBuffer.allocate(size).put(buffer.array(), buffer.position(), size).array(), "US-ASCII");
+ buffer.position(buffer.position() + size);
+
+ size = buffer.getInt();
+ message = new String(ByteBuffer.allocate(size * 2).put(buffer.array(), buffer.position(), size * 2).array(), "UTF-16LE");
+ buffer.position(buffer.position() + size * 2);
+
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+
+
+
+ //game = getNextAsciiString(buffer);
+ //galaxy = getNextAsciiString(buffer);
+ //recipient = getNextAsciiString(buffer);
+ //message = getNextUnicodeString(buffer);
+ buffer.getInt();
+ sequence = buffer.getInt();
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+ }
+
+ public String getGalaxy() { return galaxy; }
+ public String getGame() { return game; }
+ public String getMessage() { return message; }
+ public String getRecipient() { return recipient; }
+ public int getSequence() { return sequence; }
+}
diff --git a/src/protocol/swg/ChatInstantMessagetoClient.java b/src/protocol/swg/ChatInstantMessagetoClient.java
new file mode 100644
index 00000000..000ae869
--- /dev/null
+++ b/src/protocol/swg/ChatInstantMessagetoClient.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ChatInstantMessagetoClient extends SWGMessage{
+
+ private String galaxy;
+ private String message;
+ private String name;
+
+ public ChatInstantMessagetoClient(String galaxy, String message, String name) {
+
+ this.galaxy = galaxy;
+ this.message = message;
+ this.name = name;
+
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+
+ IoBuffer result = IoBuffer.allocate(30 + galaxy.length() + message.length() * 2 + name.length()).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 4);
+ result.putInt(0x3C565CED);
+ result.put(getAsciiString("SWG"));
+ result.put(getAsciiString(galaxy));
+ result.put(getAsciiString(name));
+ result.put(getUnicodeString(message));
+ result.putInt(0);
+
+ return result.flip();
+
+ }
+}
diff --git a/src/protocol/swg/ChatOnSendInstantMessage.java b/src/protocol/swg/ChatOnSendInstantMessage.java
new file mode 100644
index 00000000..66520690
--- /dev/null
+++ b/src/protocol/swg/ChatOnSendInstantMessage.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ChatOnSendInstantMessage extends SWGMessage {
+
+ private int errorType;
+ private int counter;
+
+ public ChatOnSendInstantMessage(int errorType, int counter) {
+ this.errorType = errorType;
+ this.counter = counter;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(14).order(ByteOrder.LITTLE_ENDIAN);
+ result.putShort((short) 3);
+ result.putInt(0x88DBB381);
+ result.putInt(errorType);
+ result.putInt(counter);
+
+ return result.flip();
+ }
+}
diff --git a/src/protocol/swg/ChatOnSendPersistentMessage.java b/src/protocol/swg/ChatOnSendPersistentMessage.java
new file mode 100644
index 00000000..3d8a3a48
--- /dev/null
+++ b/src/protocol/swg/ChatOnSendPersistentMessage.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ChatOnSendPersistentMessage extends SWGMessage {
+
+ private int error;
+ private int counter;
+
+ public ChatOnSendPersistentMessage(int error, int counter) {
+ this.error = error;
+ this.counter = counter;
+ }
+
+ @Override
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ @Override
+ public IoBuffer serialize() {
+
+ IoBuffer result = IoBuffer.allocate(14).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 3);
+ result.putInt(0x94E7A7AE);
+ result.putInt(error);
+ result.putInt(counter);
+
+ return result.flip();
+
+ }
+
+}
diff --git a/src/protocol/swg/ChatPersistentMessageToClient.java b/src/protocol/swg/ChatPersistentMessageToClient.java
new file mode 100644
index 00000000..08f79a3d
--- /dev/null
+++ b/src/protocol/swg/ChatPersistentMessageToClient.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ChatPersistentMessageToClient extends SWGMessage {
+
+ private String sender;
+ private String galaxyName;
+ private int mailId;
+ private byte requestTypeFlag;
+ private String message;
+ private String subject;
+ private byte status;
+ private int timestamp;
+
+ public ChatPersistentMessageToClient(String sender, String galaxyName, int mailId, byte requestTypeFlag, String message, String subject, byte status, int timestamp) {
+
+ this.sender = sender;
+ this.galaxyName = galaxyName;
+ this.mailId = mailId;
+ this.requestTypeFlag = requestTypeFlag;
+ this.message = message;
+ this.subject = subject;
+ this.status = status;
+ this.timestamp = timestamp;
+
+ }
+
+ @Override
+ public void deserialize(IoBuffer data) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public IoBuffer serialize() {
+
+ IoBuffer result = IoBuffer.allocate(41 + sender.length() + galaxyName.length() + message.length() * 2 + subject.length() * 2).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 2);
+ result.putInt(0x08485E17);
+ result.put(getAsciiString(sender));
+ result.put(getAsciiString("SWG"));
+ result.put(getAsciiString(galaxyName));
+ result.putInt(mailId);
+ result.put(requestTypeFlag);
+
+ if(requestTypeFlag == 1)
+ result.putInt(0);
+ else
+ result.put(getUnicodeString(message));
+
+ result.put(getUnicodeString(subject));
+ result.putInt(0); // attachements doing later when waypoints work
+
+ result.put(status);
+ result.putInt(timestamp);
+ result.putInt(0);
+
+ return result.flip();
+ }
+
+}
diff --git a/src/protocol/swg/ChatPersistentMessageToServer.java b/src/protocol/swg/ChatPersistentMessageToServer.java
new file mode 100644
index 00000000..40b9d142
--- /dev/null
+++ b/src/protocol/swg/ChatPersistentMessageToServer.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ChatPersistentMessageToServer extends SWGMessage {
+
+ private String message;
+ private int counter;
+ private String subject;
+ private String recipient;
+
+ @Override
+ public void deserialize(IoBuffer buffer) {
+ buffer.getShort();
+ buffer.getInt();
+
+
+ int size;
+
+ try {
+ size = buffer.getInt();
+ setMessage(new String(ByteBuffer.allocate(size * 2).put(buffer.array(), buffer.position(), size * 2).array(), "UTF-16LE"));
+ buffer.position(buffer.position() + size * 2);
+
+ int attachmentsSize = buffer.getInt(); // TODO: Implement when waypoints are done
+
+ while(attachmentsSize > 0) {
+ buffer.get();
+ --attachmentsSize;
+ }
+
+ setCounter(buffer.getInt());
+
+ size = buffer.getInt();
+ setSubject(new String(ByteBuffer.allocate(size * 2).put(buffer.array(), buffer.position(), size * 2).array(), "UTF-16LE"));
+ buffer.position(buffer.position() + size * 2);
+
+ buffer.getInt(); // spacer
+
+ size = buffer.getShort();
+ setRecipient(new String(ByteBuffer.allocate(size).put(buffer.array(), buffer.position(), size).array(), "US-ASCII"));
+ buffer.position(buffer.position() + size);
+
+
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+
+
+ }
+
+ @Override
+ public IoBuffer serialize() {
+ return null;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public String getSubject() {
+ return subject;
+ }
+
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
+
+ public String getRecipient() {
+ return recipient;
+ }
+
+ public void setRecipient(String recipient) {
+ this.recipient = recipient;
+ }
+
+ public int getCounter() {
+ return counter;
+ }
+
+ public void setCounter(int counter) {
+ this.counter = counter;
+ }
+
+}
diff --git a/src/protocol/swg/ChatRequestPersistentMessage.java b/src/protocol/swg/ChatRequestPersistentMessage.java
new file mode 100644
index 00000000..d52b4afd
--- /dev/null
+++ b/src/protocol/swg/ChatRequestPersistentMessage.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ChatRequestPersistentMessage extends SWGMessage {
+
+ private int mailId;
+
+ @Override
+ public void deserialize(IoBuffer buffer) {
+
+ buffer.getShort();
+ buffer.getInt();
+ buffer.getInt();
+ setMailId(buffer.getInt());
+
+ }
+
+ @Override
+ public IoBuffer serialize() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getMailId() {
+ return mailId;
+ }
+
+ public void setMailId(int mailId) {
+ this.mailId = mailId;
+ }
+
+}
diff --git a/src/protocol/swg/ChatSystemMessage.java b/src/protocol/swg/ChatSystemMessage.java
new file mode 100644
index 00000000..0184f00b
--- /dev/null
+++ b/src/protocol/swg/ChatSystemMessage.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ChatSystemMessage extends SWGMessage{
+
+ private String message;
+ private byte displayType;
+
+ public ChatSystemMessage(String message, byte displayType) {
+
+ this.message = message;
+ this.displayType = displayType;
+
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+
+ IoBuffer result = IoBuffer.allocate(15 + message.length() * 2).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 2);
+ result.putInt(0x6D2A6413);
+
+ result.put(displayType); // 0x00 = Chat and Screen // 0x02 = Chat only
+ result.put(getUnicodeString(message));
+ result.putInt(0); // unk
+
+ return result.flip();
+
+ }
+
+}
diff --git a/src/protocol/swg/ClientCreateCharacter.java b/src/protocol/swg/ClientCreateCharacter.java
new file mode 100644
index 00000000..491a8540
--- /dev/null
+++ b/src/protocol/swg/ClientCreateCharacter.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import engine.resources.common.Utilities;
+
+
+public class ClientCreateCharacter extends SWGMessage {
+
+ private String raceTemplate;
+ private String hairObject;
+ private byte[] hairCustomization;
+ private byte[] customizationData;
+ private float scale;
+ private String profession;
+ private String professionWheelPosition;
+ private String starterProfession;
+ private String startingLocation;
+ private String firstName;
+ private String lastName;
+ private String name;
+ private boolean tutorial;
+
+ public ClientCreateCharacter() {
+
+ }
+
+ public byte [] getCustomizationData() { return customizationData; }
+ public String getFirstName() { return firstName; }
+ public String getHairObject() { return hairObject; }
+ public byte [] getHairCustomization() { return hairCustomization; }
+ public String getLastName() { return lastName; }
+ public String getName() { return name; }
+ public String getRaceTemplate() { return raceTemplate; }
+ public String getProfession() { return profession; }
+ public String getProfessionWheelPosition() { return professionWheelPosition; }
+ public float getScale() { return scale; }
+ public String getStartingLocation() { return startingLocation; }
+ public String getStarterProfession() { return starterProfession; }
+ public boolean wantsTutorial() { return tutorial; }
+
+ public void deserialize(IoBuffer buffer) {
+ try {
+ buffer.position(6); // Skips the SOE and SWG opcodes
+ short length = buffer.getShort();
+ customizationData = new byte[length];
+ buffer.get(customizationData);
+ int size = buffer.getInt();
+ name = new String(ByteBuffer.allocate(size * 2).put(buffer.array(), buffer.position(), size * 2).array(), "UTF-16LE");
+ buffer.position(buffer.position() + size * 2);
+ size = buffer.getShort();
+ raceTemplate = new String(ByteBuffer.allocate(size).put(buffer.array(), buffer.position(), size).array(), "US-ASCII");
+ buffer.position(buffer.position() + size);
+ size = buffer.getShort();
+ startingLocation = new String(ByteBuffer.allocate(size).put(buffer.array(), buffer.position(), size).array(), "US-ASCII");
+ buffer.position(buffer.position() + size);
+ size = buffer.getShort();
+ hairObject = new String(ByteBuffer.allocate(size).put(buffer.array(), buffer.position(), size).array(), "US-ASCII");
+ buffer.position(buffer.position() + size);
+ length = buffer.getShort();
+ System.out.println("Position: " + buffer.position());
+ hairCustomization = new byte[length];
+ buffer.get(hairCustomization);
+ size = buffer.getShort();
+ starterProfession = new String(ByteBuffer.allocate(size).put(buffer.array(), buffer.position(), size).array(), "US-ASCII"); // no
+ buffer.position(buffer.position() + size);
+ buffer.get(); // unk this seems to always be 0x00
+ scale = buffer.getFloat(); // height?
+ buffer.getInt(); // Biography. There is no option to create a biography in NGE, so this is unnecessary
+ tutorial = buffer.get() == 0x01; // Tutorial Byte Flag, 0x01 if tutorial is selected
+ size = buffer.getShort();
+ profession = new String(ByteBuffer.allocate(size).put(buffer.array(), buffer.position(), size).array(), "US-ASCII"); // NGE
+ buffer.position(buffer.position() + size);
+ size = buffer.getShort();
+ professionWheelPosition = new String(ByteBuffer.allocate(size).put(buffer.array(), buffer.position(), size).array(), "US-ASCII"); // this
+ System.out.println(name + " " + raceTemplate);
+ // Gets the first and last names
+ String [] splitName = name.split(" ");
+ firstName = splitName[0];
+ lastName = (splitName.length == 1) ? "" : splitName[1];
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+ }
+
+}
diff --git a/src/protocol/swg/ClientIdMsg.java b/src/protocol/swg/ClientIdMsg.java
new file mode 100644
index 00000000..fa705229
--- /dev/null
+++ b/src/protocol/swg/ClientIdMsg.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ClientIdMsg extends SWGMessage {
+
+ private byte[] sessionKey;
+ private String version;
+
+ public ClientIdMsg() {
+
+ }
+
+
+ public void deserialize(IoBuffer buffer) {
+ buffer.position(6); // Skips SOE and SWG opcodes
+ buffer.getInt();
+ int keyLength = buffer.getInt();
+ sessionKey = new byte[keyLength];
+ buffer.get(sessionKey, 0, keyLength);
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+ }
+
+ public byte[] getSessionKey() { return sessionKey; }
+ public String getVersion() { return version; }
+}
diff --git a/src/protocol/swg/ClientPermissionsMessage.java b/src/protocol/swg/ClientPermissionsMessage.java
new file mode 100644
index 00000000..b2f7dc22
--- /dev/null
+++ b/src/protocol/swg/ClientPermissionsMessage.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ClientPermissionsMessage extends SWGMessage {
+
+ public ClientPermissionsMessage() {
+ operandCount = 5;
+ opcode = 0xE00730E5;
+
+ data = new byte[] { (byte)0x01, (byte)0x01, (byte)0x00, (byte)0x01 };
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort(operandCount);
+ result.putInt(opcode);
+ result.put(data);
+ result.flip();
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/ClientRandomNameRequest.java b/src/protocol/swg/ClientRandomNameRequest.java
new file mode 100644
index 00000000..170a115f
--- /dev/null
+++ b/src/protocol/swg/ClientRandomNameRequest.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ClientRandomNameRequest extends SWGMessage {
+
+ private String sharedRaceTemplate;
+
+ public ClientRandomNameRequest() {
+
+ }
+
+ public void deserialize(IoBuffer buffer) {
+ buffer.position(6); // Skips SOE and SWG opcodes
+ sharedRaceTemplate = getNextAsciiString(buffer);
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+ }
+
+ public String getSharedRaceTemplate() { return sharedRaceTemplate; }
+
+}
diff --git a/src/protocol/swg/ClientRandomNameResponse.java b/src/protocol/swg/ClientRandomNameResponse.java
new file mode 100644
index 00000000..fb26ad88
--- /dev/null
+++ b/src/protocol/swg/ClientRandomNameResponse.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ClientRandomNameResponse extends SWGMessage {
+
+ private String raceTemplate;
+ private String name;
+
+ public ClientRandomNameResponse(String raceTemplate, String name) {
+
+ this.raceTemplate = raceTemplate;
+ this.name = name;
+
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+
+ IoBuffer result = IoBuffer.allocate(35 + raceTemplate.length() + name.length() * 2).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)4);
+ result.putInt(0xE85FB868);
+ result.put(getAsciiString(raceTemplate)); // Race File
+ result.put(getUnicodeString(name)); // Random Name
+ result.put(getAsciiString("ui")); // STF File
+ result.putInt(0); // Spacer/unk
+ result.put(getAsciiString("name_approved")); // Approves Name, for Random Name Generation this always needs to be "name_approved"
+
+ result.flip();
+ return result;
+ }
+
+}
diff --git a/src/protocol/swg/ClientUIErrorMessage.java b/src/protocol/swg/ClientUIErrorMessage.java
new file mode 100644
index 00000000..4ebfa1be
--- /dev/null
+++ b/src/protocol/swg/ClientUIErrorMessage.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ClientUIErrorMessage extends SWGMessage {
+
+ private String errorType;
+ private String errorMessage;
+
+ public ClientUIErrorMessage(String errorType, String errorMessage) {
+ operandCount = 3;
+ opcode = 0xB5ABF91A;
+
+ this.errorType = errorType;
+ this.errorMessage = errorMessage;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ int size = 11 + errorType.length() + errorMessage.length();
+ IoBuffer result = IoBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort(operandCount);
+ result.putInt(opcode);
+ result.put(getAsciiString(errorType));
+ result.put(getAsciiString(errorMessage));
+ result.put((byte)0);
+ result.flip();
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/ClientVerifyAndLockNameRequest.java b/src/protocol/swg/ClientVerifyAndLockNameRequest.java
new file mode 100644
index 00000000..8b775bb9
--- /dev/null
+++ b/src/protocol/swg/ClientVerifyAndLockNameRequest.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ClientVerifyAndLockNameRequest extends SWGMessage {
+
+ private String name;
+ private String raceTemplate;
+ private String firstName;
+ private String lastName;
+
+ public ClientVerifyAndLockNameRequest() {
+
+ }
+
+ public void deserialize(IoBuffer buffer) {
+ buffer.position(6); // Skips SOE and SWG opcodes
+ raceTemplate = getNextAsciiString(buffer);
+ name = getNextUnicodeString(buffer);;
+
+ // Gets the first and last names
+ String [] splitName = name.split(" ");
+ firstName = splitName[0];
+ lastName = (splitName.length == 1) ? "" : splitName[1];
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+ }
+
+ public String getFirstName() { return firstName; }
+ public String getLastName() { return lastName; }
+ public String getName() { return name; }
+ public String getRaceTemplate() { return raceTemplate; }
+}
diff --git a/src/protocol/swg/ClientVerifyAndLockNameResponse.java b/src/protocol/swg/ClientVerifyAndLockNameResponse.java
new file mode 100644
index 00000000..117d933b
--- /dev/null
+++ b/src/protocol/swg/ClientVerifyAndLockNameResponse.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ClientVerifyAndLockNameResponse extends SWGMessage {
+
+ private String firstName;
+ private String approved_flag;
+
+ public ClientVerifyAndLockNameResponse(String firstName, String approved_flag) {
+
+ this.firstName = firstName;
+ this.approved_flag = approved_flag;
+
+
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(20 + firstName.length() * 2 + approved_flag.length()).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 9);
+ result.putInt(0x9B2C6BA7);
+ result.put(getUnicodeString(firstName));
+ result.put(getAsciiString("ui"));
+ result.putInt(0);
+ result.put(getAsciiString(approved_flag));
+
+ return result.flip();
+ }
+
+}
diff --git a/src/protocol/swg/CmdSceneReady.java b/src/protocol/swg/CmdSceneReady.java
new file mode 100644
index 00000000..f8763cfa
--- /dev/null
+++ b/src/protocol/swg/CmdSceneReady.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class CmdSceneReady extends SWGMessage {
+
+ public CmdSceneReady() {
+ data = new byte[] { (byte)0x01, (byte)0x00, (byte)0x22, (byte)0x1C, (byte)0xFD, (byte)0x43 };
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.wrap(data);
+ }
+}
diff --git a/src/protocol/swg/CmdStartScene.java b/src/protocol/swg/CmdStartScene.java
new file mode 100644
index 00000000..23df186a
--- /dev/null
+++ b/src/protocol/swg/CmdStartScene.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class CmdStartScene extends SWGMessage {
+
+ private byte ignoreLayoutFiles;
+ private long characterId;
+ private String terrainFile;
+ private String sharedRaceTemplate;
+ private float x;
+ private float y;
+ private float z;
+ private long time ;
+ private float radians;
+
+ public CmdStartScene(byte ignoreLayoutFiles, long characterId, String terrainFile, String sharedRaceTemplate, float x, float y, float z, long time, float radians) {
+
+ this.ignoreLayoutFiles = ignoreLayoutFiles;
+ this.characterId= characterId;
+ this.terrainFile = terrainFile;
+ this.sharedRaceTemplate = sharedRaceTemplate;
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.time = time;
+ this.radians = radians;
+
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+
+ IoBuffer result = IoBuffer.allocate(47 + terrainFile.length() + sharedRaceTemplate.length()).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)9);
+ result.putInt(0x3AE6DFAE);
+ result.put((byte)ignoreLayoutFiles);
+ result.putLong(characterId);
+ result.put(getAsciiString(terrainFile));
+ result.putFloat(x);
+ result.putFloat(y);
+ result.putFloat(z);
+ result.putFloat(radians);
+ result.put(getAsciiString(sharedRaceTemplate));
+
+ result.putLong(time);
+ result.put(new byte[] { (byte)0x8B, (byte)0xC0, (byte)0xEA, (byte)0x4E });
+ return result.flip();
+
+ }
+}
diff --git a/src/protocol/swg/ConGenericMessage.java b/src/protocol/swg/ConGenericMessage.java
new file mode 100644
index 00000000..f8c64dfb
--- /dev/null
+++ b/src/protocol/swg/ConGenericMessage.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.SWGMessage;
+
+public class ConGenericMessage extends SWGMessage {
+
+ private String message;
+
+ public ConGenericMessage(String message) {
+ operandCount = 3;
+ opcode = 0x08C5FC76;
+
+ this.message = message;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ int size = 20 + message.length();
+
+ IoBuffer result = IoBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort(operandCount);
+ result.putInt(opcode);
+ result.put(getAsciiString(message));
+ result.putInt(0);
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/ConnectionServerLagResponse.java b/src/protocol/swg/ConnectionServerLagResponse.java
new file mode 100644
index 00000000..a1d3943d
--- /dev/null
+++ b/src/protocol/swg/ConnectionServerLagResponse.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.SWGMessage;
+
+public class ConnectionServerLagResponse extends SWGMessage{
+
+ public ConnectionServerLagResponse() {
+ operandCount = 1;
+ opcode = 0x1590F63C;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(6).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort(operandCount);
+ result.putInt(opcode);
+
+ return result.flip();
+ }
+}
diff --git a/src/protocol/swg/CreateCharacterFailed.java b/src/protocol/swg/CreateCharacterFailed.java
new file mode 100644
index 00000000..ba3208f5
--- /dev/null
+++ b/src/protocol/swg/CreateCharacterFailed.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class CreateCharacterFailed extends SWGMessage {
+
+ //TODO: research packet struct
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+ }
+}
diff --git a/src/protocol/swg/CreateCharacterSuccess.java b/src/protocol/swg/CreateCharacterSuccess.java
new file mode 100644
index 00000000..36490295
--- /dev/null
+++ b/src/protocol/swg/CreateCharacterSuccess.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class CreateCharacterSuccess extends SWGMessage {
+
+
+ private long charId;
+
+ public CreateCharacterSuccess(long charId) {
+
+ this.charId = charId;
+
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(14).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 2);
+ result.putInt(0x1DB575CC);
+ result.putLong(charId);
+ result.flip();
+ return result;
+ }
+}
diff --git a/src/protocol/swg/DeleteCharacterMessage.java b/src/protocol/swg/DeleteCharacterMessage.java
new file mode 100644
index 00000000..cb5ecc93
--- /dev/null
+++ b/src/protocol/swg/DeleteCharacterMessage.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class DeleteCharacterMessage extends SWGMessage {
+
+
+ private int galaxyId;
+ private long charId;
+
+
+ public DeleteCharacterMessage() {
+
+
+ }
+
+ public int getgalaxyId() { return galaxyId; }
+ public long getcharId() { return charId; }
+
+ public void deserialize(IoBuffer data) {
+
+ data.position(6);
+ galaxyId = data.getInt();
+ charId = data.getLong();
+
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+
+ }
+}
diff --git a/src/protocol/swg/DeleteCharacterReplyMessage.java b/src/protocol/swg/DeleteCharacterReplyMessage.java
new file mode 100644
index 00000000..c8e94302
--- /dev/null
+++ b/src/protocol/swg/DeleteCharacterReplyMessage.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+
+
+public class DeleteCharacterReplyMessage extends SWGMessage {
+
+ private int FailureFlag;
+
+ public DeleteCharacterReplyMessage(int FailureFlag) {
+
+ this.FailureFlag = FailureFlag;
+
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 2);
+ result.putInt(0x8268989B);
+ result.putInt(FailureFlag);
+
+ result.flip();
+ return result;
+ }
+}
diff --git a/src/protocol/swg/EnumerateCharacterId.java b/src/protocol/swg/EnumerateCharacterId.java
new file mode 100644
index 00000000..2db68690
--- /dev/null
+++ b/src/protocol/swg/EnumerateCharacterId.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class EnumerateCharacterId extends SWGMessage {
+
+ private byte[] characters;
+ private int characterCount = 0;
+
+ public EnumerateCharacterId() {
+ ByteBuffer result = ByteBuffer.allocate(6).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)2);
+ result.putInt(0x65EA4574);
+
+ data = result.array();
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ if (characters == null) {
+ IoBuffer result = IoBuffer.allocate(9 + data.length).order(ByteOrder.LITTLE_ENDIAN);
+ result.put(data);
+
+ result.putInt(0);
+ result.put((byte) 0);
+ result.flip();
+
+ return result;
+ } else {
+ IoBuffer result = IoBuffer.allocate(4 + data.length + characters.length).order(ByteOrder.LITTLE_ENDIAN);
+ result.put(data);
+ result.putInt(characterCount);
+ result.put(characters);
+ result.flip();
+ return result;
+ }
+
+ }
+
+ public int getSize() {
+ return (data == null) ? 0 : data.length + characters.length + 4;
+ }
+
+ public void addCharacter(String character, int speciesCRC, long characterID, int galaxyID, int status) {
+ IoBuffer result = IoBuffer.allocate(24 + character.length() * 2).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.put(getUnicodeString(character));
+ result.putInt(speciesCRC);
+ result.putLong(characterID);
+ result.putInt(galaxyID);
+ result.putInt(status);
+ result.flip();
+
+ if (characters == null)
+ characters = result.array();
+ else
+ characters = IoBuffer.allocate(characters.length + result.capacity())
+ .put(characters)
+ .put(result.array())
+ .flip()
+ .array();
+ characterCount++;
+ }
+}
diff --git a/src/protocol/swg/ErrorMessage.java b/src/protocol/swg/ErrorMessage.java
new file mode 100644
index 00000000..652e1b6f
--- /dev/null
+++ b/src/protocol/swg/ErrorMessage.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ErrorMessage extends SWGMessage {
+
+ private String errorType;
+ private String errorMessage;
+
+ public ErrorMessage(String errorType, String errorMessage) {
+ this.errorType = errorType;
+ this.errorMessage = errorMessage;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(11 + errorType.length() + errorMessage.length());
+
+ result.putShort((short)3);
+ result.putInt(0xB5ABF91A);
+ result.put(getAsciiString(errorType));
+ result.put(getAsciiString(errorMessage));
+ result.put((byte)0);
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/GalaxyLoopTimesResponse.java b/src/protocol/swg/GalaxyLoopTimesResponse.java
new file mode 100644
index 00000000..70367c62
--- /dev/null
+++ b/src/protocol/swg/GalaxyLoopTimesResponse.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class GalaxyLoopTimesResponse extends SWGMessage {
+
+ private long time;
+
+ public GalaxyLoopTimesResponse(int time) {
+ this.time = time;
+ }
+
+ @Override
+ public void deserialize(IoBuffer data) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(22).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 3);
+ result.putInt(0x4E428088);
+ result.putInt((int) time);
+ result.putInt((int) time);
+ result.flip();
+ return result;
+ }
+
+}
diff --git a/src/protocol/swg/GameServerLagResponse.java b/src/protocol/swg/GameServerLagResponse.java
new file mode 100644
index 00000000..cd364f1e
--- /dev/null
+++ b/src/protocol/swg/GameServerLagResponse.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class GameServerLagResponse extends SWGMessage{
+
+ public GameServerLagResponse() {
+ operandCount = 1;
+ opcode = 0x789A4E0A;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(6).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort(operandCount);
+ result.putInt(opcode);
+
+ return result.flip();
+ }
+}
diff --git a/src/protocol/swg/GetMapLocationsMessage.java b/src/protocol/swg/GetMapLocationsMessage.java
new file mode 100644
index 00000000..710094a2
--- /dev/null
+++ b/src/protocol/swg/GetMapLocationsMessage.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class GetMapLocationsMessage extends SWGMessage{
+
+ private String planet;
+ private float x, y;
+ private byte category;
+ private byte subCategory;
+ private byte icon;
+
+ public GetMapLocationsMessage() {
+
+ }
+
+ public void deserialize(IoBuffer buffer) {
+ planet = getAsciiString(buffer);
+ x = buffer.getFloat();
+ y = buffer.getFloat();
+ category = buffer.get();
+ subCategory = buffer.get();
+ icon = buffer.get();
+ }
+
+ public IoBuffer serialize() {
+ return null;
+ }
+
+ public byte getCategory() { return category; }
+ public byte getIcon() { return icon; }
+ public String getPlanet() { return planet; }
+ public byte getSubCategory() { return subCategory; }
+ public float getX() { return x; }
+ public float getY() { return y; }
+}
diff --git a/src/protocol/swg/GetMapLocationsResponseMessage.java b/src/protocol/swg/GetMapLocationsResponseMessage.java
new file mode 100644
index 00000000..a9142880
--- /dev/null
+++ b/src/protocol/swg/GetMapLocationsResponseMessage.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class GetMapLocationsResponseMessage extends SWGMessage {
+
+ public GetMapLocationsResponseMessage(String planet, String name) {
+ ByteBuffer result = ByteBuffer.allocate(496).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 8);
+ result.putInt(0x9F80464C);
+ result.put(getAsciiString(planet));
+
+ // List
+ for (int i = 0; i < 3; i++) {
+ // blank list 1 + 2, no idea why they are needed
+ result.putInt(23 + name.length() * 2);
+
+ result.putLong(100); // ID
+ result.put(getUnicodeString(name));
+ result.putFloat(0); // x
+ result.putFloat(0); // y
+ result.put((byte) 2); // category
+ result.put((byte) 0); // sub category
+ result.put((byte) 0); // is active
+ }
+
+ result.putInt(0);
+ result.putInt(0); // 3 unks
+ result.putInt(0);
+
+ data = result.array();
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.wrap(data);
+ }
+}
diff --git a/src/protocol/swg/HeartBeatMessage.java b/src/protocol/swg/HeartBeatMessage.java
new file mode 100644
index 00000000..b9f63859
--- /dev/null
+++ b/src/protocol/swg/HeartBeatMessage.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class HeartBeatMessage extends SWGMessage {
+
+ private short operandCount;
+
+ public HeartBeatMessage() {
+ operandCount = 1;
+ opcode = 0xA16CF9AF;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(6).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort(operandCount);
+ result.putInt(opcode);
+ result.flip();
+ return result;
+ }
+}
diff --git a/src/protocol/swg/LagRequest.java b/src/protocol/swg/LagRequest.java
new file mode 100644
index 00000000..e4479027
--- /dev/null
+++ b/src/protocol/swg/LagRequest.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class LagRequest extends SWGMessage {
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+ }
+}
diff --git a/src/protocol/swg/LoginClientId.java b/src/protocol/swg/LoginClientId.java
new file mode 100644
index 00000000..e1e49325
--- /dev/null
+++ b/src/protocol/swg/LoginClientId.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class LoginClientId extends SWGMessage {
+
+ private String accountName;
+ private String password;
+ private String version;
+
+ public LoginClientId() {
+
+ }
+
+ public void deserialize(IoBuffer buffer) {
+ buffer.position(6);
+ accountName = getNextAsciiString(buffer);
+ password = getNextAsciiString(buffer);
+ version = getNextAsciiString(buffer);
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+ }
+
+ public String getAccountName() { return accountName; }
+ public String getPassword() { return password; }
+ public String getVersion() { return version; }
+}
diff --git a/src/protocol/swg/LoginClientToken.java b/src/protocol/swg/LoginClientToken.java
new file mode 100644
index 00000000..f4ce4865
--- /dev/null
+++ b/src/protocol/swg/LoginClientToken.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class LoginClientToken extends SWGMessage {
+
+ private byte[] sessionKey;
+ private int stationID;
+ private String accountName;
+
+ public LoginClientToken(byte[] sessionKey, int stationID, String accountName) {
+ this.sessionKey = sessionKey;
+ this.stationID = stationID;
+ this.accountName = accountName;
+
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+
+ IoBuffer result = IoBuffer.allocate(16 + sessionKey.length + accountName.length()).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)4);
+ result.putInt(0xAAB296C6);
+ result.putInt(sessionKey.length);
+ result.put(sessionKey);
+ result.putInt(stationID);
+ result.put(getAsciiString(accountName));
+ result.flip();
+ return result;
+
+ }
+}
diff --git a/src/protocol/swg/LoginClusterStatus.java b/src/protocol/swg/LoginClusterStatus.java
new file mode 100644
index 00000000..aaf45fbb
--- /dev/null
+++ b/src/protocol/swg/LoginClusterStatus.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.TimeZone;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class LoginClusterStatus extends SWGMessage {
+
+ private byte[] servers;
+ private int serverCount = 0;
+ private TimeZone timeZone = TimeZone.getDefault();
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(10 + servers.length).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)2);
+ result.putInt(0x3436AEB6);
+ result.putInt(serverCount);
+ result.put(servers);
+ result.flip();
+ return result;
+ }
+ public void addServer(int galaxyID, String serverIP, int serverPort, int pingPort, int maxCharacters, int status, int recommended, int population) {
+ IoBuffer result = IoBuffer.allocate(39 + serverIP.length()).order(ByteOrder.LITTLE_ENDIAN);
+
+ int populationStatus = 0;
+ result.putInt(galaxyID);
+ result.put(getAsciiString(serverIP));
+ result.putShort((short)serverPort);
+ result.putShort((short)pingPort);
+ result.putInt(population); // ServerPopulation, if not 0xFFFFFFFF then it will show the population in brackets
+ if(population >= 300 && population < 600)
+ populationStatus = 1;
+ else if(population < 900)
+ populationStatus = 2;
+ else if(population < 1200)
+ populationStatus = 3;
+ else if(population < 1500)
+ populationStatus = 4;
+ else if(population < 3000)
+ populationStatus = 5;
+ else if(population == 3000) {
+ populationStatus = 6;
+ status = 3;
+ }
+ result.putInt(populationStatus); // 0 = very light, 1 = light, 2 = medium , 3 = heavy, 4 = very heavy, 5 = extremely heavy, 6 = full
+ result.putInt(maxCharacters);
+ //result.putInt(0xFFFF8F80); // Distance?
+ result.putInt(timeZone.getRawOffset() / 3600000);
+ result.putInt(status);
+ result.put((byte)recommended);
+ result.putInt(2500); // Unknown
+ result.putInt(250); // Unknown
+ result.flip();
+
+ if (servers == null)
+ servers = result.array();
+ else
+ servers = IoBuffer.allocate(servers.length + result.capacity())
+ .put(servers)
+ .put(result.array())
+ .flip()
+ .array();
+ serverCount++;
+ }
+}
diff --git a/src/protocol/swg/LoginEnumCluster.java b/src/protocol/swg/LoginEnumCluster.java
new file mode 100644
index 00000000..8a006548
--- /dev/null
+++ b/src/protocol/swg/LoginEnumCluster.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.TimeZone;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class LoginEnumCluster extends SWGMessage {
+
+ private byte[] servers;
+ private int serverCount = 0;
+ private int maxCharacters = 8;
+ private int maxPopulation = 250;
+ private int maxConcurrent = 12;
+ private TimeZone timeZone = TimeZone.getDefault();
+
+ public LoginEnumCluster(int maxCharacters) {
+ this.maxCharacters = maxCharacters;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ if (servers == null || servers.length == 0)
+ return IoBuffer.allocate(0);
+
+ IoBuffer result = IoBuffer.allocate(22 + servers.length).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)3);
+ result.putInt(0xC11C63B9);
+ result.putInt(serverCount);
+ result.put(servers);
+ result.putInt(maxCharacters);
+ result.putInt(maxPopulation);
+ result.putInt(maxConcurrent);
+
+ int size = result.position();
+ return IoBuffer.allocate(size).put(result.array(), 0, size).flip();
+
+ }
+
+ public void addServer(int galaxyID, String serverName) {
+ IoBuffer result = IoBuffer.allocate(10 + serverName.length()).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putInt(galaxyID);
+ result.put(getAsciiString(serverName));
+ result.putInt(timeZone.getRawOffset() / 3600000);
+ result.flip();
+
+ if (servers == null)
+ servers = result.array();
+ else
+ servers = IoBuffer.allocate(servers.length + result.capacity())
+ .put(servers)
+ .put(result.array())
+ .flip()
+ .array();
+ serverCount++;
+ }
+
+ public int getSize() {
+ return 22 + servers.length;
+ }
+}
diff --git a/src/protocol/swg/LoginServerId.java b/src/protocol/swg/LoginServerId.java
new file mode 100644
index 00000000..ca01ae90
--- /dev/null
+++ b/src/protocol/swg/LoginServerId.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class LoginServerId extends SWGMessage {
+
+ private int loginServerID;
+
+ public LoginServerId(int loginServerID) {
+ this.loginServerID = loginServerID;
+ }
+
+ public void deserialize(IoBuffer buffer) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
+
+ buffer.putShort((short)2);
+ buffer.putInt(0x58C07F21);
+ buffer.putInt(loginServerID);
+ buffer.flip();
+
+ return buffer;
+ }
+}
diff --git a/src/protocol/swg/LoginServerString.java b/src/protocol/swg/LoginServerString.java
new file mode 100644
index 00000000..0f178b0b
--- /dev/null
+++ b/src/protocol/swg/LoginServerString.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class LoginServerString extends SWGMessage {
+
+ private String loginServerString;
+
+ public LoginServerString(String loginServerString) {
+ this.loginServerString = loginServerString;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(8 + loginServerString.length()).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)2);
+ result.putInt(0x0E20D7E9);
+ result.putShort((short)loginServerString.length());
+ result.put(loginServerString.getBytes());
+ result.flip();
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/LogoutMessage.java b/src/protocol/swg/LogoutMessage.java
new file mode 100644
index 00000000..3f835aa6
--- /dev/null
+++ b/src/protocol/swg/LogoutMessage.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class LogoutMessage extends SWGMessage{
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(6).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 2);
+ result.putInt(0x42FD19DD);
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/ObjControllerMessage.java b/src/protocol/swg/ObjControllerMessage.java
new file mode 100644
index 00000000..68d1f813
--- /dev/null
+++ b/src/protocol/swg/ObjControllerMessage.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+import protocol.swg.objectControllerObjects.CommandEnqueue;
+import protocol.swg.objectControllerObjects.DataTransform;
+import protocol.swg.objectControllerObjects.DataTransformWithParent;
+import protocol.swg.objectControllerObjects.ObjControllerObject;
+import protocol.swg.objectControllerObjects.UnknownObjController;
+
+public class ObjControllerMessage extends SWGMessage {
+
+ private ObjControllerObject objControllerObject;
+ private final int controllerObjectIndex = 10;
+ private int update;
+
+ public static final int DATA_TRANSFORM = 0x0071;
+ public static final int SPACIAL_CHAT = 0x00F4;
+ public static final int COMMAND_ENQUEUE = 0x0116;
+ public static final int USE_OBJECT = 0x0126;
+ public static final int PLAYER_EMOTE = 0x012E;
+ public static final int DATA_TRANSFORM_WITH_PARENT = 0x00F1;
+ public static final int COMBAT_ACTION = 0x00CC;
+ public static final int COMBAT_SPAM = 0x0134;
+ public static final int POSTURE = 0x0131;
+ public static final int SIT_ON_OBJECT = 0x013B;
+
+ public ObjControllerMessage() {
+
+ }
+
+ public ObjControllerMessage(int update, ObjControllerObject objControllerObject) {
+ this.update = update;
+ this.objControllerObject = objControllerObject;
+ }
+
+ public void deserialize(IoBuffer buffer) {
+ update = buffer.getInt(6);
+ objControllerObject = getControllerObject(buffer.getInt(controllerObjectIndex));
+ objControllerObject.deserialize(buffer);
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer buffer = IoBuffer.allocate(1024).order(ByteOrder.LITTLE_ENDIAN);
+
+ buffer.putShort((short)5);
+ buffer.putInt(0x80CE5E46);
+ buffer.putInt(update);
+ buffer.put(objControllerObject.serialize());
+
+ int size = buffer.position();
+ return IoBuffer.allocate(size).put(buffer.array(), 0, size).flip();
+ }
+
+ private ObjControllerObject getControllerObject(int objType) {
+ switch (objType) {
+ case DATA_TRANSFORM: return new DataTransform();
+ case DATA_TRANSFORM_WITH_PARENT: return new DataTransformWithParent();
+ case COMMAND_ENQUEUE: return new CommandEnqueue();
+ default: return new UnknownObjController();
+ }
+ }
+}
diff --git a/src/protocol/swg/OpenedContainerMessage.java b/src/protocol/swg/OpenedContainerMessage.java
new file mode 100644
index 00000000..171a6d37
--- /dev/null
+++ b/src/protocol/swg/OpenedContainerMessage.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class OpenedContainerMessage extends SWGMessage {
+
+ private long containerId;
+
+ public OpenedContainerMessage(long containerId) {
+ this.containerId = containerId;
+ }
+
+ @Override
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ @Override
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(20).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 2);
+ result.putInt(0x2E11E4AB);
+ result.putInt(0); // arrangement ID ?
+ result.putLong(containerId);
+ result.putShort((short) 0); // slot name ?
+
+ return result.flip();
+ }
+
+
+
+}
diff --git a/src/protocol/swg/ParametersMessage.java b/src/protocol/swg/ParametersMessage.java
new file mode 100644
index 00000000..fbc87a36
--- /dev/null
+++ b/src/protocol/swg/ParametersMessage.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ParametersMessage extends SWGMessage {
+
+ public ParametersMessage() {
+
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer packet = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
+
+ packet.putShort((short) 2);
+ packet.putInt(0x7102B15F);
+ packet.putInt(0x00000384);
+
+ return packet.flip();
+ }
+}
diff --git a/src/protocol/swg/PostureTest.java b/src/protocol/swg/PostureTest.java
new file mode 100644
index 00000000..eeb4c88a
--- /dev/null
+++ b/src/protocol/swg/PostureTest.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class PostureTest extends SWGMessage {
+
+ private long objectId;
+ private byte posture;
+
+ public PostureTest(long objectId, byte posture) {
+ this.objectId = objectId;
+ this.posture = posture;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 5);
+ result.putInt(0x80CE5E46);
+ result.putInt(0x1B);
+ result.putInt(0x131);
+ result.putLong(objectId);
+ result.putInt(0); //unk
+ result.put((byte) posture);
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/RawMessage.java b/src/protocol/swg/RawMessage.java
new file mode 100644
index 00000000..d409706d
--- /dev/null
+++ b/src/protocol/swg/RawMessage.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class RawMessage extends SWGMessage {
+
+ public RawMessage() {
+
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+ }
+}
diff --git a/src/protocol/swg/RequestExtendedClusterInfo.java b/src/protocol/swg/RequestExtendedClusterInfo.java
new file mode 100644
index 00000000..0784e8bd
--- /dev/null
+++ b/src/protocol/swg/RequestExtendedClusterInfo.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class RequestExtendedClusterInfo extends SWGMessage {
+
+ public RequestExtendedClusterInfo() {
+
+ }
+
+ public void deserialize(IoBuffer buffer) {
+
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+ }
+}
diff --git a/src/protocol/swg/SUICreatePageMessage.java b/src/protocol/swg/SUICreatePageMessage.java
new file mode 100644
index 00000000..bc72aafd
--- /dev/null
+++ b/src/protocol/swg/SUICreatePageMessage.java
@@ -0,0 +1,327 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class SUICreatePageMessage extends SWGMessage{
+
+ private String script;
+ private byte[] header;
+ private int optionCount;
+ private int windowId;
+ private byte[] body;
+ private long objectId;
+
+
+
+ public SUICreatePageMessage() {
+
+ ByteBuffer result = ByteBuffer.allocate(6).order(ByteOrder.LITTLE_ENDIAN);
+
+
+
+
+
+ /*
+ result.putShort((short) 2);
+ result.putInt(0xD44B7259); // CRC
+ result.putInt(0x00F85E88); //I'm gonna guess this is an ID of sorts.
+ result.put(getAsciiString("Script.transfer")); // change this to Script.InputBox and look at the things you can select lol
+
+ result.putInt(8); //list size/number of lists
+
+ //---------------------1
+
+
+
+ result.put((byte)5);
+ result.putInt(0); //counter I think.
+
+
+ result.putInt(3); //list size
+ result.putShort((short) 0);
+ result.putShort((short) 1); // unks
+ result.put((byte) 9);
+ result.put(getAsciiString("handleSUI"));
+
+ //---------------------2
+
+
+
+ result.put((byte)5);
+ result.putInt(0); //counter I think.
+
+
+ result.putInt(3); //list size
+ result.putShort((short) 0);
+ result.putShort((short) 1); // unks
+ result.put((byte) 0x0A);
+ result.put(getAsciiString("handleSUI"));
+
+
+ //--------------------------- 3
+ result.put((byte)3);
+ result.putInt(1); //counter I think
+ result.put(getUnicodeString("@travel:ticket_purchase_complete"));
+
+ result.putInt(2); //counter I think
+ result.put(getAsciiString("Prompt.lblPrompt"));
+ result.put(getAsciiString("Text"));
+
+
+
+
+ //--------------------------- 4
+ result.put((byte)3);
+ result.putInt(1); //counter I think
+ result.put(getUnicodeString("@base_player:swg"));
+
+ result.putInt(2); //counter I think
+ result.put(getAsciiString("bg.caption.lblTitle"));
+ result.put(getAsciiString("Text"));
+
+
+
+ //--------------------------- 5
+ result.put((byte)3);
+ result.putInt(1); //counter I think
+ result.put(getUnicodeString("True"));
+
+ result.putInt(2); //counter I think
+ result.put(getAsciiString("btnCancel"));
+ result.put(getAsciiString("Enabled"));
+
+ //--------------------------- 6
+ result.put((byte)3);
+ result.putInt(1); //counter I think
+ result.put(getUnicodeString("False"));
+
+ result.putInt(2); //counter I think
+ result.put(getAsciiString("btnCancel"));
+ result.put(getAsciiString("Visible"));
+
+
+
+
+ //--------------------------- 7
+ result.put((byte)4);
+ result.putInt(1);
+ result.put(getUnicodeString("False"));
+ result.putInt(2); //counter I think
+ result.put(getAsciiString("btnRevert"));
+ result.put(getAsciiString("Enabled"));
+
+ //--------------------------- 8
+ result.put((byte)3);
+ result.putInt(1);
+ result.put(getUnicodeString("False"));
+ result.putInt(2); //counter I think
+ result.put(getAsciiString("btnRevert"));
+ result.put(getAsciiString("Visible"));
+
+
+ //I dunno what these are/do.
+ result.putLong(0);
+
+ result.putInt(0x7F7FFFFF);
+ result.putInt(0x7F7FFFFF);
+ result.putInt(0x7F7FFFFF);
+ result.putInt(0);
+ */
+
+
+ result.putShort((short) 2);
+ result.putInt(0xD44B7259); // CRC
+
+
+
+ data = result.array();
+
+
+
+ }
+
+ public void addHeader(String handler, String[] options, int windowId, String script, long objectId) {
+
+
+ this.windowId = windowId;
+ this.script = script;
+ this.objectId = objectId;
+
+ if(options != null) {
+ ByteBuffer result = ByteBuffer.allocate((18 + handler.length() + options.length) * 2).order(ByteOrder.LITTLE_ENDIAN);
+ result.put((byte) 5);
+ result.putInt(0);
+ int counter = 0;
+ for (int i = 0; i < options.length; i ++){
+ if (options[i] != null) {
+ counter ++;
+ }
+
+ }
+ result.putInt(counter+3);
+ result.putShort((short) 0);
+ result.putShort((short) 1);
+ result.put((byte) 0x09);
+ result.put(getAsciiString(handler));
+ for (int i = 0; i < options.length; i ++){
+ if (options[i] != null) {
+ result.put(getAsciiString(options[i]));
+ }
+
+ }
+
+ result.put((byte) 5);
+ result.putInt(0);
+
+ result.putInt(counter+3);
+ result.putShort((short) 0);
+ result.putShort((short) 1);
+ result.put((byte) 0x0A);
+ result.put(getAsciiString(handler));
+ for (int i = 0; i < options.length; i ++){
+ if (options[i] != null) {
+ result.put(getAsciiString(options[i]));
+ }
+
+ }
+
+
+ if (header == null)
+ header = result.array();
+ else
+ header = ByteBuffer.allocate(header.length + result.capacity())
+ .put(header)
+ .put(result.array())
+ .array();
+ optionCount++;
+ }
+
+ else {
+ ByteBuffer result = ByteBuffer.allocate((16 + handler.length()) * 2).order(ByteOrder.LITTLE_ENDIAN);
+ result.put((byte) 5);
+ result.putInt(0);
+
+ result.putInt(3);
+ result.putShort((short) 0);
+ result.putShort((short) 1);
+ result.put((byte) 0x09);
+ result.put(getAsciiString(handler));
+
+
+ result.put((byte) 5);
+ result.putInt(0);
+
+ result.putInt(3);
+ result.putShort((short) 0);
+ result.putShort((short) 1);
+ result.put((byte) 0x0A);
+ result.put(getAsciiString(handler));
+
+
+
+ header = result.array();
+ optionCount++;
+ optionCount++;
+
+ }
+
+ }
+
+ public void addBodyElement(byte type, String wideParameter, String narrowParameterVariable, String narrowParameterSetting) {
+
+
+
+ if(type == 3 || type == 4) {
+ ByteBuffer result = ByteBuffer.allocate(17 + wideParameter.length() * 2 + narrowParameterVariable.length() + narrowParameterSetting.length()).order(ByteOrder.LITTLE_ENDIAN);
+
+
+ result.put(type);
+ result.putInt(1);
+ result.put(getUnicodeString(wideParameter));
+ result.putInt(2);
+ result.put(getAsciiString(narrowParameterVariable));
+ result.put(getAsciiString(narrowParameterSetting));
+
+ if (body == null)
+ body = result.array();
+ else
+ body = ByteBuffer.allocate(body.length + result.capacity())
+ .put(body)
+ .put(result.array())
+ .array();
+ optionCount++;
+
+
+ }
+
+ else {
+ ByteBuffer result = ByteBuffer.allocate(13 + wideParameter.length() * 2).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.put(type);
+ result.putInt(0);
+ result.putInt(1);
+ result.put(getUnicodeString(wideParameter));
+
+ if (body == null)
+ body = result.array();
+ else
+ body = ByteBuffer.allocate(body.length + result.capacity())
+ .put(body)
+ .put(result.array())
+ .array();
+ optionCount++;
+
+
+ }
+
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+
+ IoBuffer result = IoBuffer.allocate(34 + data.length + header.length + body.length + script.length()).order(ByteOrder.LITTLE_ENDIAN);
+ result.put(data);
+ result.putInt(windowId);
+ result.put(getAsciiString(script));
+ result.putInt(optionCount); //list size/number of lists
+ result.put(header);
+ result.put(body);
+ result.putLong(objectId);
+ result.putFloat(0); //range to object specified by objectId, if 0 range is unlimited
+ result.putLong(0);
+ /*result.putInt(0x7F7FFFFF);
+ result.putInt(0x7F7FFFFF);
+ result.putInt(0x7F7FFFFF);
+ result.putInt(0);*/
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/SUIForceClosePageMessage.java b/src/protocol/swg/SUIForceClosePageMessage.java
new file mode 100644
index 00000000..b014ce46
--- /dev/null
+++ b/src/protocol/swg/SUIForceClosePageMessage.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+public class SUIForceClosePageMessage extends SWGMessage {
+
+ private int windowId;
+
+ public SUIForceClosePageMessage(int windowId) {
+ this.windowId = windowId;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 2);
+ result.putInt(0x990B5DE0);
+ result.putInt(windowId);
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/SWGMessage.java b/src/protocol/swg/SWGMessage.java
new file mode 100644
index 00000000..529e7cda
--- /dev/null
+++ b/src/protocol/swg/SWGMessage.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+
+import protocol.Message;
+
+
+
+public abstract class SWGMessage extends Message {
+
+ protected short operandCount;
+
+ public SWGMessage() {
+
+ }
+
+ public SWGMessage(byte[] data) {
+ super(data);
+ opcode = ByteBuffer.wrap(data).getInt(2);
+ }
+}
diff --git a/src/protocol/swg/SWGMessageFactory.java b/src/protocol/swg/SWGMessageFactory.java
new file mode 100644
index 00000000..fc5bd8c3
--- /dev/null
+++ b/src/protocol/swg/SWGMessageFactory.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteBuffer;
+
+import protocol.Message;
+
+
+public class SWGMessageFactory {
+
+ public Message getMessage(byte[] data) {
+
+ /*if (data.length < 4)
+ return new UnknownMessage(data);*/
+
+ Message message;
+
+ if (data[0] < 0x10 && data[1] == 0x00)
+ message = getMessageType(data);
+ else {
+
+ message = getMessageType(data);
+
+ }
+
+ return message;
+
+ }
+ private Message getMessageType(byte[] data) {
+
+ try {
+
+ int opcode = ByteBuffer.wrap(data).getInt(2);
+ switch (Integer.reverseBytes(opcode)) {
+
+ case 0x31805EE0: return new LagRequest();
+ case 0x41131F96: return new LoginClientId();
+ case 0x80CE5E46: return new ObjControllerMessage();
+ case 0x8E33ED05: return new RequestExtendedClusterInfo();
+ case 0xB5098D76: return new SelectCharacter();
+ case 0xD5899226: return new ClientIdMsg();
+ case 0x84BB21F7: return new ChatInstantMessageToCharacter();
+ case 0xD6D1B6D1: return new ClientRandomNameRequest();
+ case 0x9EB04B9F: return new ClientVerifyAndLockNameRequest();
+ case 0xB97F3074: return new ClientCreateCharacter();
+ //case 0xE87AD031: return new DeleteCharacterMessage(data);
+ case 0x1A7AB839: return new GetMapLocationsMessage();
+ case 0x43FD1C22: return new CmdSceneReady();
+ }
+
+ } catch (Exception e) {
+
+ e.printStackTrace();
+
+ }
+ return null;
+
+ //return new UnknownMessage(data);
+
+ }
+
+}
diff --git a/src/protocol/swg/SceneCreateObjectByCrc.java b/src/protocol/swg/SceneCreateObjectByCrc.java
new file mode 100644
index 00000000..5b3921a0
--- /dev/null
+++ b/src/protocol/swg/SceneCreateObjectByCrc.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class SceneCreateObjectByCrc extends SWGMessage {
+
+ private long objectId;
+ private float oX;
+ private float oY;
+ private float oZ;
+ private float oW;
+ private float pX;
+ private float pY;
+ private float pZ;
+ private int crc;
+ private byte flags;
+
+ public SceneCreateObjectByCrc(long objectId, float orientationX, float orientationY, float orientationZ, float orientationW, float positionX, float positionY, float positionZ, int objectCRC, byte flags) {
+ this.objectId = objectId;
+
+ this.oX = orientationX;
+ this.oY = orientationY;
+ this.oZ = orientationZ;
+ this.oW = orientationW;
+
+ this.pX = positionX;
+ this.pY = positionY;
+ this.pZ = positionZ;
+
+ this.crc = objectCRC;
+ this.flags = flags;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(47).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)5);
+ result.putInt(0xFE89DDEA);
+ result.putLong(objectId);
+ result.putFloat(oX);
+ result.putFloat(oY);
+ result.putFloat(oZ);
+ result.putFloat(oW);
+ result.putFloat(pX);
+ result.putFloat(pY);
+ result.putFloat(pZ);
+ result.putInt(crc);
+ result.put(flags);
+ result.flip();
+ return result;
+ }
+}
diff --git a/src/protocol/swg/SceneDestroyObject.java b/src/protocol/swg/SceneDestroyObject.java
new file mode 100644
index 00000000..75edc1d5
--- /dev/null
+++ b/src/protocol/swg/SceneDestroyObject.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class SceneDestroyObject extends SWGMessage {
+
+ private long objectId;
+
+ public SceneDestroyObject(long objectId) {
+ this.objectId = objectId;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(15).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)3);
+ result.putInt(0x4D45D504);
+
+ result.putLong(objectId);
+ return result;
+ }
+}
diff --git a/src/protocol/swg/SceneEndBaselines.java b/src/protocol/swg/SceneEndBaselines.java
new file mode 100644
index 00000000..d37bd67f
--- /dev/null
+++ b/src/protocol/swg/SceneEndBaselines.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class SceneEndBaselines extends SWGMessage {
+
+ private long objectId;
+
+ public SceneEndBaselines(long objectId) {
+ this.objectId = objectId;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(14).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)2);
+ result.putInt(0x2C436037);
+
+ result.putLong(objectId);
+ result.flip();
+ return result;
+ }
+}
diff --git a/src/protocol/swg/SelectCharacter.java b/src/protocol/swg/SelectCharacter.java
new file mode 100644
index 00000000..94b92077
--- /dev/null
+++ b/src/protocol/swg/SelectCharacter.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class SelectCharacter extends SWGMessage {
+
+ private long characterId;
+
+ public SelectCharacter() {
+
+ }
+
+ public void deserialize(IoBuffer buffer) {
+ buffer.position(6);
+ characterId = buffer.getLong();
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+ }
+
+ public long getCharacterId() { return characterId; }
+}
diff --git a/src/protocol/swg/ServerNowEpochTime.java b/src/protocol/swg/ServerNowEpochTime.java
new file mode 100644
index 00000000..32d8b75d
--- /dev/null
+++ b/src/protocol/swg/ServerNowEpochTime.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ServerNowEpochTime extends SWGMessage {
+
+ private int serverNowEpochTime;
+
+ public ServerNowEpochTime(int serverNowEpochTime) {
+ this.serverNowEpochTime = serverNowEpochTime;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(10);
+
+ result.order(ByteOrder.LITTLE_ENDIAN).putShort((short)2);
+ result.order(ByteOrder.BIG_ENDIAN).putInt(0x9338B724);
+ result.order(ByteOrder.LITTLE_ENDIAN).putInt(serverNowEpochTime);
+ result.flip();
+ return result;
+ }
+}
diff --git a/src/protocol/swg/ServerTimeMessage.java b/src/protocol/swg/ServerTimeMessage.java
new file mode 100644
index 00000000..317c3534
--- /dev/null
+++ b/src/protocol/swg/ServerTimeMessage.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ServerTimeMessage extends SWGMessage {
+
+ private long time;
+
+ public ServerTimeMessage(long time) {
+ this.time = time;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(20).order(ByteOrder.LITTLE_ENDIAN);;
+
+ result.putShort((short)2);
+ result.putInt(0x2EBC3BD9);
+ result.putLong(time); //time in milliseconds
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/ServerWeatherMessage.java b/src/protocol/swg/ServerWeatherMessage.java
new file mode 100644
index 00000000..dfe21b2d
--- /dev/null
+++ b/src/protocol/swg/ServerWeatherMessage.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class ServerWeatherMessage extends SWGMessage {
+
+ private int weatherId;
+ private float cloudX;
+ private float cloudY;
+ private float cloudZ;
+
+ public ServerWeatherMessage(int weatherId, float cloudX, float cloudY, float cloudZ) {
+ this.weatherId = weatherId;
+ this.cloudX = cloudX;
+ this.cloudY = cloudY;
+ this.cloudZ = cloudZ;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(26).order(ByteOrder.LITTLE_ENDIAN);;
+
+ result.putShort((short)3);
+ result.putInt(0x486356EA);
+ result.putInt(weatherId);
+ result.putFloat(cloudX);
+ result.putFloat(cloudY);
+ result.putFloat(cloudZ);
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/SitOnObjectTest.java b/src/protocol/swg/SitOnObjectTest.java
new file mode 100644
index 00000000..5154f6a2
--- /dev/null
+++ b/src/protocol/swg/SitOnObjectTest.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class SitOnObjectTest extends SWGMessage {
+
+ private float x;
+ private float y;
+ private float z;
+ private long cellId;
+ private long objectId;
+
+ public SitOnObjectTest(float x, float y, float z, long cellId, long objectId) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.cellId = cellId;
+ this.objectId = objectId;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(50).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 5);
+ result.putInt(0x80CE5E46);
+ result.putInt(0x1B);
+ result.putInt(0x13B);
+ result.putLong(objectId);
+ result.putInt(0);
+ result.putLong(cellId);
+ result.putFloat(x);
+ result.putFloat(y);
+ result.putFloat(z);
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/StationIdHasJediSlot.java b/src/protocol/swg/StationIdHasJediSlot.java
new file mode 100644
index 00000000..4660fbae
--- /dev/null
+++ b/src/protocol/swg/StationIdHasJediSlot.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class StationIdHasJediSlot extends SWGMessage {
+
+ private boolean hasJedi;
+
+ public StationIdHasJediSlot(boolean hasJedi) {
+ this.hasJedi = hasJedi;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)2);
+ result.putInt(0xCC9FCCF8);
+ result.putInt(hasJedi ? 1 : 0);
+ result.flip();
+ return result;
+ }
+}
diff --git a/src/protocol/swg/TeleportTransform.java b/src/protocol/swg/TeleportTransform.java
new file mode 100644
index 00000000..e2a61630
--- /dev/null
+++ b/src/protocol/swg/TeleportTransform.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.SWGMessage;
+
+public class TeleportTransform extends SWGMessage {
+
+ private long charId;
+ private float x;
+ private float y;
+ private float z;
+ private float yOrient;
+ private float wOrient;
+ private int movementIndex;
+
+ public TeleportTransform(long charId, float x, float y, float z, float yOrient, float wOrient, int movementIndex) {
+ this.charId = charId;
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.yOrient = yOrient;
+ this.wOrient = wOrient;
+ this.movementIndex = movementIndex;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)5);
+ result.putInt(0x80CE5E46);
+ result.putInt(0x1B); // this is a special flag for DataTransform, other flags don't teleport the player
+ result.putInt(0x71);
+ result.putLong(charId);
+ result.putInt(0);
+ result.putInt(0);
+ result.putInt(movementIndex+1);
+ result.putFloat(0);
+ result.putFloat(yOrient);
+ result.putFloat(0);
+ result.putFloat(wOrient);
+
+ result.putFloat(x);
+ result.putFloat(y);
+ result.putFloat(z);
+
+ result.putFloat(0);
+ result.putFloat(0);
+ result.put((byte)0x01);
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/TeleportTransformWithParent.java b/src/protocol/swg/TeleportTransformWithParent.java
new file mode 100644
index 00000000..b27112bb
--- /dev/null
+++ b/src/protocol/swg/TeleportTransformWithParent.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.SWGMessage;
+
+public class TeleportTransformWithParent extends SWGMessage {
+
+ private long charId;
+ private float x;
+ private float y;
+ private float z;
+ private float yOrient;
+ private float wOrient;
+ private long cellId;
+ private int movementIndex;
+
+ public TeleportTransformWithParent(long charId, float x, float y, float z, float yOrient, float wOrient, long cellId, int movementIndex) {
+ this.charId = charId;
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.yOrient = yOrient;
+ this.wOrient = wOrient;
+ this.cellId = cellId;
+ this.movementIndex = movementIndex;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)5);
+ result.putInt(0x80CE5E46);
+ result.putInt(0x1B); // this is a special flag for DataTransformWithParent, other flags don't teleport the player
+ result.putInt(0xF1);
+ result.putLong(charId);
+ result.putInt(0);
+ result.putInt(0);
+ result.putInt(movementIndex+1);
+ result.putLong(cellId);
+ result.putFloat(0);
+ result.putFloat(yOrient);
+ result.putFloat(0);
+ result.putFloat(wOrient);
+
+ result.putFloat(x);
+ result.putFloat(y);
+ result.putFloat(z);
+
+ result.putFloat(0);
+ result.putFloat(0);
+ result.put((byte)0x01);
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/UnkByteFlag.java b/src/protocol/swg/UnkByteFlag.java
new file mode 100644
index 00000000..2dc0da15
--- /dev/null
+++ b/src/protocol/swg/UnkByteFlag.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.SWGMessage;
+
+public class UnkByteFlag extends SWGMessage {
+
+ @Override
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ @Override
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(7).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 2);
+ result.putInt(0x7102B15F);
+ result.put((byte) 1);
+
+ return result.flip();
+ }
+
+}
diff --git a/src/protocol/swg/UpdateCellPermissionMessage.java b/src/protocol/swg/UpdateCellPermissionMessage.java
new file mode 100644
index 00000000..fe35f240
--- /dev/null
+++ b/src/protocol/swg/UpdateCellPermissionMessage.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.SWGMessage;
+
+public class UpdateCellPermissionMessage extends SWGMessage {
+
+ private byte permission;
+ private long cellId;
+
+ public UpdateCellPermissionMessage(byte permission, long cellId) {
+ this.permission = permission;
+ this.cellId = cellId;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(128).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)3);
+ result.putInt(0xF612499C);
+ result.put(permission);
+ result.putLong(cellId);
+
+ return result;
+ }
+}
diff --git a/src/protocol/swg/UpdateContainmentMessage.java b/src/protocol/swg/UpdateContainmentMessage.java
new file mode 100644
index 00000000..72515b9b
--- /dev/null
+++ b/src/protocol/swg/UpdateContainmentMessage.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.SWGMessage;
+
+public class UpdateContainmentMessage extends SWGMessage {
+
+ private long objectId;
+ private long containmentId;
+ private int slotIndex;
+
+ public UpdateContainmentMessage(long objectId, long containmentId, int slotIndex) {
+ this.objectId = objectId;
+ this.containmentId = containmentId;
+ this.slotIndex = slotIndex;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(26).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)4);
+ result.putInt(0x56CBDE9E);
+ result.putLong(objectId);
+ result.putLong(containmentId);
+ result.putInt(slotIndex);
+ result.flip();
+ return result;
+ }
+}
diff --git a/src/protocol/swg/UpdatePVPStatusMessage.java b/src/protocol/swg/UpdatePVPStatusMessage.java
new file mode 100644
index 00000000..152ef4ca
--- /dev/null
+++ b/src/protocol/swg/UpdatePVPStatusMessage.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.SWGMessage;
+
+public class UpdatePVPStatusMessage extends SWGMessage {
+
+ private long objectId;
+ private int pvpStatus;
+
+ public UpdatePVPStatusMessage(long objectId, int pvpStatus) {
+ this.objectId = objectId;
+ this.pvpStatus = pvpStatus;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(22).order(ByteOrder.LITTLE_ENDIAN);;
+
+ result.putShort((short)4);
+ result.putInt(0x08A1C126);
+ result.putInt(pvpStatus);
+ result.putInt(0); // faction crc
+ result.putLong(objectId);
+ result.flip();
+ return result;
+ }
+}
diff --git a/src/protocol/swg/UpdatePostureMessage.java b/src/protocol/swg/UpdatePostureMessage.java
new file mode 100644
index 00000000..35bed3ff
--- /dev/null
+++ b/src/protocol/swg/UpdatePostureMessage.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.SWGMessage;
+
+public class UpdatePostureMessage extends SWGMessage {
+
+ private long objectId;
+ private byte posture;
+
+ public UpdatePostureMessage(long objectId, byte posture) {
+ this.objectId = objectId;
+ this.posture = posture;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(15).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short)3);
+ result.putInt(0x0BDE6B41);
+
+ result.put(posture);
+ result.putLong(objectId);
+
+ return result.flip();
+ }
+}
diff --git a/src/protocol/swg/UpdateTransformMessage.java b/src/protocol/swg/UpdateTransformMessage.java
new file mode 100644
index 00000000..555e2a2b
--- /dev/null
+++ b/src/protocol/swg/UpdateTransformMessage.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.SWGMessage;
+
+public class UpdateTransformMessage extends SWGMessage {
+
+ private long objectId;
+ private short x;
+ private short y;
+ private short z;
+ private int movementCounter;
+ private byte direction;
+ private float speed;
+ private byte combatFlag;
+
+ public UpdateTransformMessage(long objectId, short x, short y, short z, int movementCounter, byte direction, float speed, byte combatFlag) {
+ this.objectId = objectId;
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.movementCounter = movementCounter;
+ this.direction = direction;
+ this.speed = speed;
+ this.combatFlag = combatFlag;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(42).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 0x0A);
+ result.putInt(0x1B24F808);
+ result.putLong(objectId);
+ result.putShort((short) x);
+ result.putShort((short) y);
+ result.putShort((short) z);
+ result.putInt(movementCounter+1);
+ result.put((byte) speed);
+ result.put((byte) direction);
+ result.put((byte) 0);
+ result.put(combatFlag);
+ result.flip();
+ return result;
+ }
+}
diff --git a/src/protocol/swg/UpdateTransformWithParentMessage.java b/src/protocol/swg/UpdateTransformWithParentMessage.java
new file mode 100644
index 00000000..fd3ca8e9
--- /dev/null
+++ b/src/protocol/swg/UpdateTransformWithParentMessage.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.SWGMessage;
+
+public class UpdateTransformWithParentMessage extends SWGMessage {
+
+ private long objectId;
+ private long cellId;
+ private short x;
+ private short y;
+ private short z;
+ private int movementCounter;
+ private byte direction;
+ private float speed;
+ private byte combatFlag;
+
+ public UpdateTransformWithParentMessage(long objectId, long cellId, short x, short y, short z, int movementCounter, byte direction, float speed, byte combatFlag) {
+ this.objectId = objectId;
+ this.cellId = cellId;
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.movementCounter = movementCounter;
+ this.direction = direction;
+ this.speed = speed;
+ this.combatFlag = combatFlag;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(42).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putShort((short) 0x0A);
+ result.putInt(0xC867AB5A);
+ result.putLong(cellId);
+ result.putLong(objectId);
+ result.putShort(x);
+ result.putShort(y);
+ result.putShort(z);
+ result.putInt(movementCounter+1);
+ result.put((byte) speed);
+ result.put(direction);
+ result.put(combatFlag);
+ result.flip();
+ return result;
+ }
+}
diff --git a/src/protocol/swg/objectControllerObjects/CombatAction.java b/src/protocol/swg/objectControllerObjects/CombatAction.java
new file mode 100644
index 00000000..6a119b38
--- /dev/null
+++ b/src/protocol/swg/objectControllerObjects/CombatAction.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg.objectControllerObjects;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.ObjControllerMessage;
+
+public class CombatAction extends ObjControllerObject{
+
+ private int actionCRC;
+ private long attackerId;
+ private long weaponId;
+ private long defenderId;
+
+ public CombatAction(int actionCRC, long attackerId, long weaponId, long defenderId) {
+ this.actionCRC = actionCRC;
+ this.attackerId = attackerId;
+ this.weaponId = weaponId;
+ this.defenderId = defenderId;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putInt(ObjControllerMessage.COMBAT_ACTION);
+
+ result.putLong(attackerId);
+ result.putInt(0);
+ result.putInt(actionCRC);
+ result.putLong(attackerId);
+ result.putLong(weaponId);
+ result.put((byte) 0);
+ result.put((byte) 1);
+ result.put((byte) 0);
+ byte[] unkdata = new byte[] {
+ 0x2B, (byte) 0x87, 0x64, (byte) 0xA1, 0x01, 0x15, 0x02, (byte) 0x97, (byte) 0xC5, 0x00, 0x00, (byte) 0xD0, 0x40, 0x6F, 0x16, (byte) 0x80, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ };
+ result.put(unkdata);
+
+ return result;
+ }
+
+ public CombatAction clone() {
+ return new CombatAction(actionCRC, attackerId, weaponId, defenderId);
+ }
+}
diff --git a/src/protocol/swg/objectControllerObjects/CombatSpam.java b/src/protocol/swg/objectControllerObjects/CombatSpam.java
new file mode 100644
index 00000000..e0ba5618
--- /dev/null
+++ b/src/protocol/swg/objectControllerObjects/CombatSpam.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg.objectControllerObjects;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.ObjControllerMessage;
+
+public class CombatSpam extends ObjControllerObject{
+
+ private long attackerId;
+ private long defenderId;
+ private int damage;
+ private String file;
+ private String text;
+ private byte colorFlag;
+ private long objectId;
+
+
+ public CombatSpam(long attackerId, long defenderId, int damage, String file, String text, byte colorFlag, long objectId) {
+ this.attackerId = attackerId;
+ this.defenderId = defenderId;
+ this.damage = damage;
+ this.file = file;
+ this.text = text;
+ this.colorFlag = colorFlag;
+ this.objectId = objectId;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putInt(ObjControllerMessage.COMBAT_SPAM);
+
+ result.putLong(objectId);
+ result.putInt(0);
+ //result.put((byte) 2); //unk
+ result.putLong(attackerId);
+ result.putLong(defenderId);
+ result.putLong(0);
+ result.putInt(damage);
+ result.putShort((short) file.length());
+ result.put(getAsciiString(file));
+ result.putInt(0);
+ result.putShort((short) text.length());
+ result.put(getAsciiString(text));
+ result.put(colorFlag);
+
+ return result;
+ }
+
+ public CombatSpam clone() {
+ return new CombatSpam(attackerId, defenderId, damage, file, text, colorFlag, objectId);
+ }
+}
diff --git a/src/protocol/swg/objectControllerObjects/CommandEnqueue.java b/src/protocol/swg/objectControllerObjects/CommandEnqueue.java
new file mode 100644
index 00000000..d94c5ad3
--- /dev/null
+++ b/src/protocol/swg/objectControllerObjects/CommandEnqueue.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg.objectControllerObjects;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+
+public class CommandEnqueue extends ObjControllerObject {
+
+ public static final int SOCIAL_INTERNAL = 0x32CF1BEE;
+ public static final int SPATIAL_CHAT = 0xEE540CF7;
+ public static final int SPATIAL_CHAT_INTERNAL = 0x7C8D63D4;
+ public static final int SIT_SERVER = 0xB719FA26;
+ public static final int PRONE = 0xBD8D02AF;
+ public static final int KNEEL = 0x01B48B26;
+ public static final int STAND = 0xA8A25C79;
+ public static final int ATTACK = 0xA8FEF90A;
+ public static final int TRANSFERITEM = 0x3CFB449D;
+
+ private int actionCounter;
+ private int commandCRC;
+ private long targetId;
+ private ObjControllerObject commandObject;
+ private final int commandObjectIndex = 20;
+ private long objectId;
+ private String commandArguments;
+
+ public CommandEnqueue() {
+
+ }
+ public CommandEnqueue(int actionCounter, ObjControllerObject commandObject) {
+ this.actionCounter = actionCounter;
+ this.commandObject = commandObject;
+ }
+
+ public void deserialize(IoBuffer buffer) {
+ objectId = buffer.getLong();
+ buffer.getInt();
+ actionCounter = buffer.getInt();
+
+ commandCRC = buffer.getInt();
+ targetId = buffer.getLong();
+ int size = buffer.getInt();
+ try {
+ commandArguments = new String(ByteBuffer.allocate(size * 2).put(buffer.array(), buffer.position(), size * 2).array(), "UTF-16LE");
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+
+ //commandArguments = getNextUnicodeString(buffer);
+ //commandObject = getCommandObject(commandCRC);
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+ }
+
+
+ public int getActionCounter() { return actionCounter; }
+ public int getCommandCRC() { return commandCRC; }
+ public long getObjectID() { return objectId; }
+ public long getTargetID() { return targetId; }
+
+ public ObjControllerObject getCommandObject() { return commandObject; }
+ public String getCommandArguments() { return commandArguments; }
+}
diff --git a/src/protocol/swg/objectControllerObjects/DataTransform.java b/src/protocol/swg/objectControllerObjects/DataTransform.java
new file mode 100644
index 00000000..522f540a
--- /dev/null
+++ b/src/protocol/swg/objectControllerObjects/DataTransform.java
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg.objectControllerObjects;
+
+import java.nio.ByteOrder;
+
+import java.lang.Math;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+
+import protocol.swg.ObjControllerMessage;
+
+public class DataTransform extends ObjControllerObject{
+
+ private long objectId;
+ private int movementIndex;
+ private float yOrientation, wOrientation, xOrientation, zOrientation;
+ private float xPosition, yPosition, zPosition, speed;
+ private int movementStamp;
+ private boolean combatFlag;
+
+ public DataTransform() {
+
+ }
+
+ public DataTransform(Point3D position, Quaternion orientation, int movementCounter, long objectId) {
+
+ xPosition = position.x;
+ yPosition = position.y;
+ zPosition = position.z;
+ yOrientation = orientation.y;
+ wOrientation = orientation.w;
+ movementIndex = movementCounter;
+ this.objectId = objectId;
+
+ }
+
+
+ public long getObjectId() { return objectId; }
+ public float getSpeed() { return speed; }
+ public float getXOrientation() { return xOrientation; }
+ public float getYOrientation() { return yOrientation; }
+ public float getZOrientation() { return zOrientation; }
+ public float getWOrientation() { return wOrientation; }
+ public float getXPosition() { return xPosition; }
+ public float getYPosition() { return yPosition; }
+ public float getZPosition() { return zPosition; }
+ public short getTransformedX() { return (short) (xPosition * 4 + 0.5); }
+ public short getTransformedY() { return (short) (yPosition * 4 + 0.5); } // need to transform coordinates as they are send as a short in UTM
+ public short getTransformedZ() { return (short) (zPosition * 4 + 0.5); }
+ public int getMovementCounter() { return movementIndex; }
+ public int getMovementStamp() { return movementStamp; }
+ public boolean getCombatFlag() { return combatFlag; }
+
+
+ public float getMovementAngle() {
+ byte movementAngle = (byte) 0.0f;
+ float wOrient = getWOrientation();
+ float yOrient = getYOrientation();
+ float sq = (float) Math.sqrt(1- (getWOrientation() * getWOrientation()));
+
+ if (sq != 0) {
+ if (getWOrientation() > 0 && getYOrientation() < 0) {
+ wOrient *= -1;
+ yOrient *= -1;
+ }
+ movementAngle = (byte) ((yOrient / sq) * (2 * Math.acos(wOrient) / 0.06283f));
+ }
+
+ return movementAngle;
+ }
+
+ public void deserialize(IoBuffer buffer) {
+ objectId = buffer.getLong();
+ buffer.getInt();
+
+ movementStamp = buffer.getInt();
+ movementIndex = buffer.getInt();
+
+ xOrientation = buffer.getFloat();
+ yOrientation = buffer.getFloat();
+ zOrientation = buffer.getFloat();
+ wOrientation = buffer.getFloat();
+
+ xPosition = buffer.getFloat();
+ yPosition = buffer.getFloat();
+ zPosition = buffer.getFloat();
+ speed = buffer.getFloat();
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(61).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putInt(ObjControllerMessage.DATA_TRANSFORM);
+ result.putLong(objectId);
+ result.putInt(0);
+
+ result.putInt(0);
+ result.putInt(movementIndex+1);
+
+ result.putFloat(0);
+ result.putFloat(yOrientation); //xRot
+ result.putFloat(0); //yRot
+ result.putFloat(wOrientation); //zRot
+
+ result.putFloat(xPosition); //xPos
+ result.putFloat(yPosition); //yPos
+ result.putFloat(zPosition); //zPos
+
+ result.putFloat(speed); //unk
+ result.putFloat(0); //unk
+ result.put((byte)0x01);
+
+ return result.flip();
+ }
+}
diff --git a/src/protocol/swg/objectControllerObjects/DataTransformWithParent.java b/src/protocol/swg/objectControllerObjects/DataTransformWithParent.java
new file mode 100644
index 00000000..e6426c0e
--- /dev/null
+++ b/src/protocol/swg/objectControllerObjects/DataTransformWithParent.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg.objectControllerObjects;
+
+import java.nio.ByteOrder;
+
+import java.lang.Math;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+
+
+
+import protocol.swg.ObjControllerMessage;
+
+public class DataTransformWithParent extends ObjControllerObject {
+
+ private long objectId;
+ private int movementIndex;
+ private float xOrientation, yOrientation, zOrientation, wOrientation;
+ private float xPosition, yPosition, zPosition, speed;
+ private long cellId;
+ private int movementStamp;
+ private boolean combatFlag;
+
+ public DataTransformWithParent() {
+
+ }
+
+ public DataTransformWithParent(Point3D position, Quaternion orientation, int movementCounter, long objectId, long cellId) {
+
+ xPosition = position.x;
+ yPosition = position.y;
+ zPosition = position.z;
+ yOrientation = orientation.y;
+ wOrientation = orientation.w;
+ movementIndex = movementCounter;
+ this.objectId = objectId;
+ this.cellId = cellId;
+
+ }
+
+ public void deserialize(IoBuffer buffer) {
+ objectId = buffer.getLong();
+ buffer.getInt();
+
+ movementStamp = buffer.getInt();
+ movementIndex = buffer.getInt();
+ cellId = buffer.getLong();
+
+ xOrientation = buffer.getFloat();
+ yOrientation = buffer.getFloat();
+ zOrientation = buffer.getFloat();
+ wOrientation = buffer.getFloat();
+
+ xPosition = buffer.getFloat();
+ yPosition = buffer.getFloat();
+ zPosition = buffer.getFloat();
+ speed = buffer.getFloat();
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(69).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putInt(ObjControllerMessage.DATA_TRANSFORM_WITH_PARENT);
+ result.putLong(objectId);
+ result.putInt(0);
+
+ result.putInt(0);
+ result.putInt(movementIndex+1);
+ result.putLong(cellId);
+
+ result.putFloat(0);
+ result.putFloat(yOrientation); //xRot
+ result.putFloat(0); //yRot
+ result.putFloat(wOrientation); //zRot
+
+ result.putFloat(xPosition); //xPos
+ result.putFloat(yPosition); //yPos
+ result.putFloat(zPosition); //zPos
+
+ result.putFloat(speed); //unk
+ result.putFloat(0); //unk
+ result.put((byte)0x01);
+ return result.flip();
+ }
+
+ public long getObjectId() { return objectId; }
+ public float getSpeed() { return speed; }
+ public float getXOrientation() { return xOrientation; }
+ public float getYOrientation() { return yOrientation; }
+ public float getZOrientation() { return zOrientation; }
+ public float getWOrientation() { return wOrientation; }
+ public float getXPosition() { return xPosition; }
+ public float getYPosition() { return yPosition; }
+ public float getZPosition() { return zPosition; }
+ public short getTransformedX() { return (short) (xPosition * 8 + 0.5); }
+ public short getTransformedY() { return (short) (yPosition * 8 + 0.5); } // need to transform coordinates as they are send as a short in UTM
+ public short getTransformedZ() { return (short) (zPosition * 8 + 0.5); }
+ public int getMovementCounter() { return movementIndex; }
+ public int getMovementStamp() { return movementStamp; }
+ public boolean getCombatFlag() { return combatFlag; }
+ public long getCellId() { return cellId; }
+
+ public float getMovementAngle() {
+ byte MovementAngle = (byte) 0.0f;
+ float wOrient = getWOrientation();
+ float yOrient = getYOrientation();
+ float sq = (float) Math.sqrt(1- (getWOrientation() * getWOrientation()));
+
+ if (sq != 0) {
+ if (getWOrientation() > 0 && getYOrientation() < 0) {
+ wOrient *= -1;
+ yOrient *= -1;
+ }
+ MovementAngle = (byte) ((yOrient / sq) * (2 * Math.acos(wOrient) / 0.06283f));
+ }
+ return MovementAngle;
+ }
+}
diff --git a/src/protocol/swg/objectControllerObjects/ObjControllerObject.java b/src/protocol/swg/objectControllerObjects/ObjControllerObject.java
new file mode 100644
index 00000000..0f75cca8
--- /dev/null
+++ b/src/protocol/swg/objectControllerObjects/ObjControllerObject.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg.objectControllerObjects;
+
+import protocol.swg.SWGMessage;
+
+public abstract class ObjControllerObject extends SWGMessage {
+
+ protected byte[] data;
+}
diff --git a/src/protocol/swg/objectControllerObjects/PlayerEmote.java b/src/protocol/swg/objectControllerObjects/PlayerEmote.java
new file mode 100644
index 00000000..4295d058
--- /dev/null
+++ b/src/protocol/swg/objectControllerObjects/PlayerEmote.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg.objectControllerObjects;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.ObjControllerMessage;
+
+public class PlayerEmote extends ObjControllerObject {
+
+ private long destinationId;
+ private long sourceId;
+ private long targetId;
+ private short emoteId;
+
+ public PlayerEmote(long sourceId, long targetId, short emoteId) {
+ this.destinationId = sourceId;
+ this.sourceId = sourceId;
+ this.targetId = targetId;
+ this.emoteId = emoteId;
+ }
+
+ public void setDestinationId(long destinationId) {
+ this.destinationId = destinationId;
+ }
+
+ public PlayerEmote clone() {
+ return new PlayerEmote(sourceId, targetId, emoteId);
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(37).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putInt(ObjControllerMessage.PLAYER_EMOTE);
+ result.putLong(destinationId);
+ result.putInt(0);
+
+ result.putLong(sourceId);
+ result.putLong(targetId);
+ result.putShort(emoteId);
+ result.putShort((short)0x0000);
+ result.put((byte)0x03);
+
+ return result.flip();
+ }
+}
diff --git a/src/protocol/swg/objectControllerObjects/Posture.java b/src/protocol/swg/objectControllerObjects/Posture.java
new file mode 100644
index 00000000..c08ffaad
--- /dev/null
+++ b/src/protocol/swg/objectControllerObjects/Posture.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg.objectControllerObjects;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.ObjControllerMessage;
+
+public class Posture extends ObjControllerObject {
+
+ private long objectId;
+ private byte posture;
+
+ public Posture(long objectId, byte posture) {
+ this.objectId = objectId;
+ this.posture = posture;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(18).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putInt(ObjControllerMessage.POSTURE);
+
+ result.putLong(objectId);
+ result.putInt(0); //unk
+ result.put((byte) posture);
+ result.put((byte) 0);
+
+ return result.flip();
+ }
+}
diff --git a/src/protocol/swg/objectControllerObjects/SitOnObject.java b/src/protocol/swg/objectControllerObjects/SitOnObject.java
new file mode 100644
index 00000000..b0befba1
--- /dev/null
+++ b/src/protocol/swg/objectControllerObjects/SitOnObject.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg.objectControllerObjects;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.ObjControllerMessage;
+
+public class SitOnObject extends ObjControllerObject {
+
+ private float x;
+ private float y;
+ private float z;
+ private long cellId;
+ private long objectId;
+
+ public SitOnObject(float x, float y, float z, long cellId, long objectId) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.cellId = cellId;
+ this.objectId = objectId;
+ }
+
+ @Override
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ @Override
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(36).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putInt(ObjControllerMessage.SIT_ON_OBJECT);
+ result.putLong(objectId);
+ result.putInt(0);
+ result.putLong(cellId);
+ result.putFloat(x);
+ result.putFloat(y);
+ result.putFloat(z);
+
+ return result.flip();
+ }
+
+}
diff --git a/src/protocol/swg/objectControllerObjects/SpatialChat.java b/src/protocol/swg/objectControllerObjects/SpatialChat.java
new file mode 100644
index 00000000..82e46da0
--- /dev/null
+++ b/src/protocol/swg/objectControllerObjects/SpatialChat.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg.objectControllerObjects;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.ObjControllerMessage;
+
+public class SpatialChat extends ObjControllerObject {
+
+ private long audienceId;
+ private long sourceId;
+ private long targetId;
+ private String chatMessage;
+ private String chatMessageParsed;
+ private short balloonSize;
+ private short balloonType = 1;
+ private short chatType;
+ private short moodId;
+
+ public SpatialChat(long sourceId, long targetId, String chatMessage, short chatType, short moodId) {
+ try {
+ this.audienceId = sourceId;
+ this.sourceId = sourceId;
+ this.targetId = targetId;
+ this.chatMessage = chatMessage;
+ this.chatType = chatType;
+ this.moodId = moodId;
+
+ /*String[] chatMessageParse = chatMessage.split(" ", 6);
+
+ this.chatMessageParsed = chatMessageParse[5];
+
+ balloonSize = (short)(Short.parseShort(chatMessageParse[4], 10) + 4);
+ //balloonType = Short.parseShort(chatMessageParse[1], 10);*/
+
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void setDestinationId(long audienceId) {
+ this.audienceId = audienceId;
+ }
+
+ public void deserialize(IoBuffer data) {
+
+ }
+
+ public IoBuffer serialize() {
+ IoBuffer result = IoBuffer.allocate(55 + chatMessage.length() * 2).order(ByteOrder.LITTLE_ENDIAN);
+
+ result.putInt(ObjControllerMessage.SPACIAL_CHAT);
+ result.putLong(audienceId);
+ result.putInt(0);
+ result.putLong(sourceId);
+ result.putLong(targetId);
+ result.put(getUnicodeString(chatMessage));
+ result.putInt(0x00000000); // Changes type of message?
+ result.putShort((short) 0x32);
+ result.putShort(chatType);
+ result.putShort(moodId);
+ result.put((byte) 1);
+
+ result.putInt(0);
+ result.putInt(0);
+
+ return result.flip();
+ }
+}
diff --git a/src/protocol/swg/objectControllerObjects/TargetUpdate.java b/src/protocol/swg/objectControllerObjects/TargetUpdate.java
new file mode 100644
index 00000000..bfac2b1b
--- /dev/null
+++ b/src/protocol/swg/objectControllerObjects/TargetUpdate.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg.objectControllerObjects;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+public class TargetUpdate extends ObjControllerObject {
+
+ private long objectId;
+ private long targetId;
+
+ @Override
+ public void deserialize(IoBuffer buffer) {
+
+ setObjectId(buffer.getLong());
+ buffer.getInt();
+ setTargetId(buffer.getLong());
+
+ }
+
+ @Override
+ public IoBuffer serialize() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public long getTargetId() {
+ return targetId;
+ }
+
+ public void setTargetId(long targetId) {
+ this.targetId = targetId;
+ }
+
+ public long getObjectId() {
+ return objectId;
+ }
+
+ public void setObjectId(long objectId) {
+ this.objectId = objectId;
+ }
+
+}
diff --git a/src/protocol/swg/objectControllerObjects/UnknownObjController.java b/src/protocol/swg/objectControllerObjects/UnknownObjController.java
new file mode 100644
index 00000000..b661f1c9
--- /dev/null
+++ b/src/protocol/swg/objectControllerObjects/UnknownObjController.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package protocol.swg.objectControllerObjects;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+public class UnknownObjController extends ObjControllerObject {
+
+ int objControllerType;
+
+ public UnknownObjController() {
+
+ }
+
+ public void deserialize(IoBuffer data) {
+ objControllerType = data.getInt();
+ }
+
+ public IoBuffer serialize() {
+ return IoBuffer.allocate(0);
+ }
+}
diff --git a/src/resources/common/ObjControllerOpcodes.java b/src/resources/common/ObjControllerOpcodes.java
new file mode 100644
index 00000000..6bdb4d08
--- /dev/null
+++ b/src/resources/common/ObjControllerOpcodes.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.common;
+
+public class ObjControllerOpcodes {
+
+ public static final int DATA_TRANSFORM = 0x71000000;
+ public static final int DATA_TRANSFORM_WITH_PARENT = 0xF1000000;
+ public static final int COMMAND_QUEUE_ENQUEUE = 0x16010000;
+ public static final int TARGET_UPDATE = 0x26010000;
+
+}
diff --git a/src/resources/common/Opcodes.java b/src/resources/common/Opcodes.java
new file mode 100644
index 00000000..6fbaa9f9
--- /dev/null
+++ b/src/resources/common/Opcodes.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.common;
+
+public class Opcodes {
+
+ public static int ChatDeletePersistentMessage = 0x8F251641;
+ public static int ChatInstantMessageToCharacter = 0x84BB21F7;
+ public static int ChatPersistentMessageToServer = 0x25A29FA6;
+ public static int ChatRequestPersistentMessage = 0x07E3559F;
+ public static int ClientOpenContainerMessage = 0x2D2D6EE1;
+ public static int CmdSceneReady = 0x43FD1C22;
+ public static int ConnectPlayerMessage = 0x2E365218;
+ public static int ClientCreateCharacter = 0xB97F3074;
+ public static int ClientIdMsg = 0xD5899226;
+ public static int ClientRandomNameRequest = 0xD6D1B6D1;
+ public static int ClientVerifyAndLockNameRequest = 0x9eb04b9f;
+ public static int DeleteCharacterMessage = 0xE87AD031;
+ public static int GetMapLocationsMessage = 0x1A7AB839;
+ public static int LagRequest = 0x31805EE0;
+ public static int LoginClientId = 0x41131F96;
+ public static int ObjControllerMessage = 0x80CE5E46;
+ public static int RequestGalaxyLoopTimes = 0x7D842D68;
+ public static int SelectCharacter = 0xB5098D76;
+
+}
diff --git a/src/resources/objects/building/BuildingMessageBuilder.java b/src/resources/objects/building/BuildingMessageBuilder.java
new file mode 100644
index 00000000..224e0a8d
--- /dev/null
+++ b/src/resources/objects/building/BuildingMessageBuilder.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.building;
+
+public class BuildingMessageBuilder {
+
+}
diff --git a/src/resources/objects/building/BuildingObject.java b/src/resources/objects/building/BuildingObject.java
new file mode 100644
index 00000000..c16cf929
--- /dev/null
+++ b/src/resources/objects/building/BuildingObject.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.building;
+
+
+
+import com.sleepycat.persist.model.Entity;
+
+import engine.clients.Client;
+import engine.resources.objects.SWGObject;
+import engine.resources.scene.Planet;
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+
+@Entity
+public class BuildingObject extends SWGObject {
+
+ public BuildingObject() {
+ super();
+ }
+
+ public BuildingObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
+ super(objectID, planet, position, orientation, Template);
+ }
+
+ @Override
+ public void sendBaselines(Client client) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
diff --git a/src/resources/objects/cell/CellMessageBuilder.java b/src/resources/objects/cell/CellMessageBuilder.java
new file mode 100644
index 00000000..63f5592b
--- /dev/null
+++ b/src/resources/objects/cell/CellMessageBuilder.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.cell;
+
+public class CellMessageBuilder {
+
+}
diff --git a/src/resources/objects/cell/CellObject.java b/src/resources/objects/cell/CellObject.java
new file mode 100644
index 00000000..a32e33b1
--- /dev/null
+++ b/src/resources/objects/cell/CellObject.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.cell;
+
+
+
+import com.sleepycat.persist.model.Persistent;
+
+import engine.clients.Client;
+import engine.resources.objects.SWGObject;
+import engine.resources.scene.Planet;
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+
+@Persistent
+public class CellObject extends SWGObject {
+
+ private int cellNumber = 0;
+
+ public CellObject() {
+ super();
+ }
+
+ public CellObject(long objectID, Planet planet, int cellNumber) {
+ super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1), "object/cell/shared_cell.iff");
+ setCellNumber(cellNumber);
+ }
+
+ public CellObject(long objectID, Planet planet) {
+ super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1), "object/cell/shared_cell.iff");
+ }
+
+ public int getCellNumber() {
+ synchronized(objectMutex) {
+ return cellNumber;
+ }
+ }
+
+ public void setCellNumber(int cellNumber) {
+ synchronized(objectMutex) {
+ this.cellNumber = cellNumber;
+ }
+ }
+
+ @Override
+ public void sendBaselines(Client client) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
diff --git a/src/resources/objects/creature/CreatureMessageBuilder.java b/src/resources/objects/creature/CreatureMessageBuilder.java
new file mode 100644
index 00000000..08fb99f7
--- /dev/null
+++ b/src/resources/objects/creature/CreatureMessageBuilder.java
@@ -0,0 +1,470 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.creature;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import engine.resources.common.CRC;
+import engine.resources.objects.ObjectMessageBuilder;
+import engine.resources.objects.SWGObject;
+import engine.resources.objects.SkillMod;
+
+import resources.objects.tangible.TangibleObject;
+import resources.objects.weapon.WeaponObject;
+
+public class CreatureMessageBuilder extends ObjectMessageBuilder {
+
+
+ public CreatureMessageBuilder(CreatureObject creatureObject) {
+
+ setObject(creatureObject);
+
+ }
+
+ public IoBuffer buildBaseline1() {
+ CreatureObject creature = (CreatureObject) object;
+ IoBuffer buffer = bufferPool.allocate(26, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.setAutoExpand(true);
+ buffer.putShort((short) 4);
+ buffer.putInt(creature.getBankCredits());
+ buffer.putInt(creature.getCashCredits());
+
+ buffer.putInt(0); // Base HAM List most likely unused in NGE
+ buffer.putInt(0);
+
+ if(creature.getSkills().isEmpty()) {
+ buffer.putInt(0);
+ buffer.putInt(creature.getSkillsUpdateCounter());
+ } else {
+ buffer.putInt(creature.getSkills().size());
+ buffer.putInt(creature.getSkillsUpdateCounter());
+ for(String skill : creature.getSkills())
+ buffer.put(getAsciiString(skill));
+ }
+ int size = buffer.position();
+
+ buffer.flip();
+ buffer = createBaseline("CREO", (byte) 1, buffer, size);
+
+ return buffer;
+
+ }
+
+ public IoBuffer buildBaseline3() {
+
+ CreatureObject creature = (CreatureObject) object;
+ IoBuffer buffer = bufferPool.allocate(300, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.putShort((short) 19); // Object Count
+ buffer.putFloat(1);
+ buffer.put(getAsciiString(creature.getStfFilename()));
+ buffer.putInt(0);
+ buffer.put(getAsciiString(creature.getStfName()));
+ buffer.put(getUnicodeString(creature.getCustomName()));
+ buffer.putInt(0x000F4240); // unk
+ String factionCRC = creature.getFaction();
+ if(factionCRC == null)
+ buffer.putInt(0);
+ else if(factionCRC.equals("neutral"))
+ buffer.putInt(0);
+ else
+ buffer.putInt(CRC.StringtoCRC(factionCRC));
+
+ buffer.putInt(creature.getFactionStatus());
+
+ byte[] customizationData = creature.getCustomizationData();
+
+ if(customizationData.length <= 0)
+ buffer.putShort((short) 0);
+ else {
+ buffer.putShort((short) customizationData.length);
+ buffer.put(customizationData);
+ }
+ buffer.putInt(1);
+ buffer.putInt(0); // TANO Data
+ buffer.putInt(0);
+ buffer.putInt(0x80);
+ buffer.putInt(creature.getIncapTimer());
+ buffer.putInt(0);
+ buffer.putInt(0x3A98);
+
+ buffer.put((byte) 1);
+ buffer.put((byte) 0);
+ buffer.put((byte) 1);
+
+ buffer.putLong(creature.getOwnerId());
+ float height = creature.getHeight();
+ if (height < 0.7 || height > 1.5) {
+ height = 1;
+ }
+ buffer.putFloat(height);
+ buffer.putInt(0); // battle fatigue
+ buffer.putLong(creature.getStateBitmask());
+ int size = buffer.position();
+
+ buffer.flip();
+ buffer = createBaseline("CREO", (byte) 3, buffer, size);
+ return buffer;
+
+ }
+
+ public IoBuffer buildBaseline4() {
+ CreatureObject creature = (CreatureObject) object;
+
+ IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.setAutoExpand(true);
+ buffer.putShort((short) 0x10);
+ buffer.putFloat(creature.getAccelerationMultiplierBase());
+ buffer.putFloat(creature.getAccelerationMultiplierMod());
+
+ buffer.putInt(0); // HAM Encumberance List unused in NGE
+ buffer.putInt(0);
+
+ if(creature.getSkillMods().isEmpty()) {
+ buffer.putInt(0);
+ buffer.putInt(0);
+ } else {
+ buffer.putInt(creature.getSkillMods().size());
+ buffer.putInt(creature.getSkillModsUpdateCounter());
+
+ for(SkillMod skillMod : creature.getSkillMods()) {
+ buffer.put((byte) 0);
+ buffer.put(getAsciiString(skillMod.getSkillModString()));
+ buffer.putInt(skillMod.getBase());
+ buffer.putInt(skillMod.getModifier());
+ }
+ }
+ buffer.putFloat(creature.getSpeedMultiplierBase());
+ buffer.putFloat(creature.getSpeedMultiplierMod());
+ buffer.putLong(0); // unk
+
+ buffer.putFloat(creature.getRunSpeed());
+
+ buffer.putFloat(creature.getSlopeModAngle());
+ buffer.putFloat(creature.getSlopeModPercent());
+ buffer.putFloat(creature.getTurnRadius());
+
+ buffer.putFloat(creature.getWalkSpeed());
+ buffer.putFloat(creature.getWaterModPercent());
+
+ buffer.putInt(0); // MissionCritical objects todo later
+ buffer.putInt(0);
+
+ if(creature.getAbilities().isEmpty()) {
+ buffer.putInt(0);
+ buffer.putInt(creature.getAbilitiesUpdateCounter());
+ } else {
+ buffer.putInt(creature.getAbilities().size());
+ buffer.putInt(creature.getAbilitiesUpdateCounter());
+
+ for(String ability : creature.getAbilities()) {
+ buffer.put((byte) 0);
+ buffer.put(getAsciiString(ability));
+ buffer.putInt(1);
+ }
+ }
+ buffer.putInt(0); // unk
+ int size = buffer.position();
+ buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
+
+ buffer.flip();
+ buffer = createBaseline("CREO", (byte) 4, buffer, size);
+
+ return buffer;
+
+ }
+
+ public IoBuffer buildBaseline6() {
+ CreatureObject creature = (CreatureObject) object;
+
+ IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.setAutoExpand(true);
+ buffer.putShort((short) 0x23);
+ buffer.putInt(0x4E);
+
+ buffer.putInt(0); // defenders list unused in NGE
+ buffer.putInt(0);
+
+ buffer.put(creature.getCombatFlag());
+
+ buffer.putLong(0);
+ buffer.putLong(0);
+ buffer.putLong(0); // Vehicle vars or TANO 6 vars TODO: research
+ buffer.putLong(0);
+ buffer.putInt(0);
+
+ //buffer.putShort(creature.getLevel());
+ buffer.putShort((short) 90);
+ buffer.putInt(0xD007); // unk
+
+ if(creature.getCurrentAnimation() == null || creature.getCurrentAnimation().length() == 0)
+ buffer.putShort((short) 0);
+ else
+ buffer.put(getAsciiString(creature.getCurrentAnimation()));
+ if(creature.getMoodAnimation() == null || creature.getMoodAnimation().length() == 0)
+ buffer.put(getAsciiString("neutral"));
+ else
+ buffer.put(getAsciiString(creature.getMoodAnimation()));
+
+ buffer.putLong(creature.getWeaponId());
+
+ buffer.putLong(creature.getGroupId());
+ buffer.putLong(creature.getInviteSenderId());
+ if(creature.getInviteSenderName() == null || creature.getInviteSenderName().length() == 0)
+ buffer.putShort((short) 0);
+ else
+ buffer.put(getAsciiString(creature.getInviteSenderName()));
+
+ buffer.putLong(creature.getInviteCounter());
+
+ buffer.putInt(creature.getGuildId());
+ buffer.putLong(creature.getTargetId());
+ buffer.put(creature.getMoodId());
+ buffer.putInt(creature.getPerformanceCounter());
+ buffer.putInt(creature.getPerformanceId());
+
+ buffer.putInt(0); // unks
+ buffer.putInt(0);
+
+ buffer.putInt(6); // Current HAM
+ buffer.putInt(0);
+
+ buffer.putInt(20000);
+ buffer.putInt(0);
+ buffer.putInt(12500);
+ buffer.putInt(0);
+ buffer.putInt(0x2C01);
+ buffer.putInt(0);
+
+ buffer.putInt(6); // Max HAM
+ buffer.putInt(0);
+
+ buffer.putInt(20000);
+ buffer.putInt(0);
+ buffer.putInt(12500);
+ buffer.putInt(0);
+ buffer.putInt(0x2C01);
+ buffer.putInt(0);
+
+ if(creature.getEquipmentList().isEmpty()) {
+ buffer.putInt(0);
+ buffer.putInt(0);
+ } else {
+ buffer.putInt(creature.getEquipmentList().size());
+ buffer.putInt(0);
+
+ for(SWGObject obj : creature.getEquipmentList()) {
+
+ if(obj instanceof TangibleObject) {
+ TangibleObject tangible = (TangibleObject) obj;
+ if(tangible.getCustomization() == null || tangible.getCustomization().length == 0) {
+ buffer.putShort((short) 0);
+ } else {
+ buffer.putShort((short) tangible.getCustomization().length);
+ buffer.put(tangible.getCustomization());
+ }
+ buffer.putInt(tangible.getArrangementId());
+ buffer.putLong(tangible.getObjectID());
+ buffer.putInt(CRC.StringtoCRC(tangible.getTemplate()));
+ buffer.put((byte) 0);
+ } else if(obj instanceof WeaponObject) {
+ WeaponObject weapon = (WeaponObject) obj;
+ if(weapon.getCustomization() == null || weapon.getCustomization().length == 0) {
+ buffer.putShort((short) 0);
+ } else {
+ buffer.putShort((short) weapon.getCustomization().length);
+ buffer.put(weapon.getCustomization());
+ }
+ buffer.putInt(weapon.getArrangementId());
+ buffer.putLong(weapon.getObjectID());
+ buffer.putInt(CRC.StringtoCRC(weapon.getTemplate()));
+
+ buffer.put((byte) 1);
+ buffer.put(weapon.getMessageBuilder().buildBaseline3());
+ buffer.put(weapon.getMessageBuilder().buildBaseline6());
+ } else {
+ System.out.println("Bad equipment object");
+ }
+
+ }
+
+ }
+ buffer.putShort((short) 0);
+ buffer.put((byte) 1);
+
+ buffer.putInt(0); // Buff List todo later
+ buffer.putInt(0);
+
+ buffer.putShort((short) 0);
+ buffer.putInt(0xFFFFFFFF);
+ buffer.put((byte) 1);
+ buffer.putShort((short) 0);
+
+ if(creature.getAppearanceEquipmentList().isEmpty()) {
+ buffer.putInt(0);
+ buffer.putInt(0);
+ } else {
+ buffer.putInt(creature.getAppearanceEquipmentList().size());
+ buffer.putInt(0);
+
+ for(SWGObject obj : creature.getAppearanceEquipmentList()) {
+
+ if(obj instanceof TangibleObject) {
+ TangibleObject tangible = (TangibleObject) obj;
+ if(tangible.getCustomization() == null || tangible.getCustomization().length == 0) {
+ buffer.putShort((short) 0);
+ } else {
+ buffer.putShort((short) tangible.getCustomization().length);
+ buffer.put(tangible.getCustomization());
+ }
+ buffer.putInt(tangible.getArrangementId());
+ buffer.putLong(tangible.getObjectID());
+ buffer.putInt(CRC.StringtoCRC(tangible.getTemplate()));
+ buffer.put((byte) 0);
+ } else {
+ System.out.println("Bad appearance equipment object");
+ }
+
+ }
+ }
+
+ buffer.putInt(0);
+ buffer.putInt(0);
+ //buffer.put((byte) 0);
+
+
+
+ /*buffer.putShort((short) 1);
+ buffer.putInt(0);
+ buffer.putInt(0xFFFFFFFF);
+ buffer.putInt(1);
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putShort((short) 0);
+ buffer.put((byte)0);*/
+
+ int size = buffer.position();
+ buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
+
+
+ buffer.flip();
+ buffer = createBaseline("CREO", (byte) 6, buffer, size);
+
+ return buffer;
+
+ }
+
+ public IoBuffer buildBaseline8() {
+
+ IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.putShort((short) 0);
+ int size = buffer.position();
+ buffer.flip();
+ buffer = createBaseline("CREO", (byte) 8, buffer, size);
+
+ return buffer;
+
+ }
+
+ public IoBuffer buildBaseline9() {
+
+ IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.putShort((short) 0);
+ int size = buffer.position();
+ buffer.flip();
+ buffer = createBaseline("CREO", (byte) 9, buffer, size);
+
+ return buffer;
+
+ }
+
+ public IoBuffer buildPostureDelta(byte posture) {
+
+ IoBuffer buffer = bufferPool.allocate(1, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.put(posture);
+ int size = buffer.position();
+ buffer.flip();
+ buffer = createDelta("CREO", (byte) 3, (short) 1, (short) 0x0D, buffer, size + 4);
+
+ return buffer;
+
+ }
+
+ public IoBuffer buildStateDelta(long state) {
+
+ IoBuffer buffer = bufferPool.allocate(8, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.putLong(state);
+ int size = buffer.position();
+ buffer.flip();
+ buffer = createDelta("CREO", (byte) 3, (short) 1, (short) 0x12, buffer, size + 4);
+
+ return buffer;
+
+ }
+
+ public IoBuffer buildSpeedModDelta(float speed) {
+
+ IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.putFloat(speed);
+ int size = buffer.position();
+ buffer.flip();
+ buffer = createDelta("CREO", (byte) 4, (short) 1, (short) 4, buffer, size + 4);
+
+ return buffer;
+
+ }
+
+ public IoBuffer buildTurnRadiusDelta(float turnRadius) {
+
+ IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.putFloat(turnRadius);
+ int size = buffer.position();
+ buffer.flip();
+ buffer = createDelta("CREO", (byte) 4, (short) 1, (short) 0x0A, buffer, size + 4);
+
+ return buffer;
+
+ }
+
+ public IoBuffer buildTargetDelta(long targetId) {
+
+ IoBuffer buffer = bufferPool.allocate(8, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.putLong(targetId);
+ int size = buffer.position();
+ buffer.flip();
+ buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x10, buffer, size + 4);
+
+ return buffer;
+
+ }
+
+
+ @Override
+ public void sendBaselines() {
+
+
+
+ }
+
+}
diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java
new file mode 100644
index 00000000..c9e235da
--- /dev/null
+++ b/src/resources/objects/creature/CreatureObject.java
@@ -0,0 +1,751 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.creature;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import protocol.swg.ChatSystemMessage;
+import protocol.swg.ObjControllerMessage;
+import protocol.swg.UpdatePVPStatusMessage;
+import protocol.swg.UpdatePostureMessage;
+import protocol.swg.objectControllerObjects.Posture;
+
+
+
+import com.sleepycat.je.Environment;
+import com.sleepycat.je.Transaction;
+import com.sleepycat.persist.model.Entity;
+import com.sleepycat.persist.model.NotPersistent;
+
+import engine.clients.Client;
+import engine.resources.objects.Buff;
+import engine.resources.objects.IPersistent;
+import engine.resources.objects.MissionCriticalObject;
+import engine.resources.objects.SWGObject;
+import engine.resources.objects.SkillMod;
+import engine.resources.scene.Planet;
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+
+import resources.objects.tangible.TangibleObject;
+import resources.objects.weapon.WeaponObject;
+
+@Entity
+public class CreatureObject extends SWGObject implements IPersistent {
+
+ @NotPersistent
+ private Transaction txn;
+
+ // CREO 1
+ private int bankCredits = 0;
+ private int cashCredits = 0;
+ private List skills = new ArrayList();
+ @NotPersistent
+ private int skillsUpdateCounter = 0;
+
+ // CREO 3
+ private byte[] customizationData;
+ private int optionBitmask = 0;
+ private int incapTimer = 10;
+ private byte posture = 0;
+ private String faction;
+ private int factionStatus = 0;
+ private float height;
+ private int battleFatigue = 0;
+ private long stateBitmask = 0;
+ private long ownerId = 0;
+
+ // CREO 4
+ private float accelerationMultiplierBase = 1;
+ private float accelerationMultiplierMod = 1;
+ private List skillMods = new ArrayList();
+ @NotPersistent
+ private int skillModsUpdateCounter = 0;
+ private float speedMultiplierBase = 1;
+ private float speedMultiplierMod = 1;
+ private long listenToId = 0;
+ private float runSpeed = (float) 7.3;
+ private float slopeModAngle = 1;
+ private float slopeModPercent = 1;
+ private float turnRadius = 1;
+ private float walkSpeed = (float) 2.75;
+ private float waterModPercent = 1;
+ private List abilities = new ArrayList();
+ private int abilitiesUpdateCounter = 0;
+
+ private List missionCriticalObjects = new ArrayList();
+ @NotPersistent
+ private int missionCriticalObjectsUpdateCounter = 0;
+
+
+ // CREO6
+ @NotPersistent
+ private List defendersList = new ArrayList(); // unused in packets but useful for the server
+ private byte combatFlag = 0;
+ private short level = 0;
+ private String currentAnimation;
+ private String moodAnimation;
+ private long weaponId = 0;
+ private long groupId = 0;
+ private long inviteSenderId = 0;
+ private String inviteSenderName;
+ private long inviteCounter = 0;
+ private int guildId = 0;
+ private long targetId = 0;
+ private byte moodId = 0;
+ private int performanceCounter = 0;
+ private int performanceId = 0;
+ private List equipmentList = new ArrayList();
+ @NotPersistent
+ private int equipmentListUpdateCounter = 0;
+ private List buffList = new ArrayList();
+ @NotPersistent
+ private int buffListUpdateCounter = 0;
+ private List appearanceEquipmentList = new ArrayList();
+ @NotPersistent
+ private int appearanceEquipmentListUpdateCounter = 0;
+
+ // non-baseline vars
+ @NotPersistent
+ private List duelList = Collections.synchronizedList(new ArrayList());
+ @NotPersistent
+ private CreatureMessageBuilder messageBuilder;
+
+
+ public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
+ super(objectID, planet, position, orientation, Template);
+ messageBuilder = new CreatureMessageBuilder(this);
+ }
+
+ public CreatureObject() {
+ super();
+ messageBuilder = new CreatureMessageBuilder(this);
+ }
+
+ public Transaction getTransaction() { return txn; }
+
+ public void createTransaction(Environment env) { txn = env.beginTransaction(null, null); }
+
+ public int getBankCredits() {
+ synchronized(objectMutex) {
+ return bankCredits;
+ }
+ }
+
+ public void setBankCredits(int bankCredits) {
+ synchronized(objectMutex) {
+ this.bankCredits = bankCredits;
+ }
+ }
+
+ public int getCashCredits() {
+ synchronized(objectMutex) {
+ return cashCredits;
+ }
+ }
+
+ public void setCashCredits(int cashCredits) {
+ synchronized(objectMutex) {
+ this.cashCredits = cashCredits;
+ }
+ }
+
+ public List getSkills() {
+ return skills;
+ }
+
+ public short getSkillsUpdateCounter() {
+ synchronized(objectMutex) {
+ return (short) skillsUpdateCounter;
+ }
+ }
+
+ public void setSkillsUpdateCounter(short skillsUpdateCounter) {
+ synchronized(objectMutex) {
+ this.skillsUpdateCounter = skillsUpdateCounter;
+ }
+ }
+
+ public byte[] getCustomizationData() {
+ synchronized(objectMutex) {
+ return customizationData;
+ }
+ }
+
+ public void setCustomizationData(byte[] customizationData) {
+ synchronized(objectMutex) {
+ this.customizationData = customizationData;
+ }
+ }
+
+ public int getOptionBitmask() {
+ synchronized(objectMutex) {
+ return optionBitmask;
+ }
+ }
+
+ public void setOptionBitmask(int optionBitmask) {
+ synchronized(objectMutex) {
+ this.optionBitmask = optionBitmask;
+ }
+ }
+
+ public int getIncapTimer() {
+ synchronized(objectMutex) {
+ return incapTimer;
+ }
+ }
+
+ public void setIncapTimer(int incapTimer) {
+ synchronized(objectMutex) {
+ this.incapTimer = incapTimer;
+ }
+ }
+
+ public byte getPosture() {
+ synchronized(objectMutex) {
+ return posture;
+ }
+ }
+
+ public void setPosture(byte posture) {
+ synchronized(objectMutex) {
+ this.posture = posture;
+ }
+ IoBuffer postureDelta = messageBuilder.buildPostureDelta(posture);
+ Posture postureUpdate = new Posture(getObjectID(), posture);
+ ObjControllerMessage objController = new ObjControllerMessage(0x1B, postureUpdate);
+
+ notifyObservers(postureDelta, true);
+ notifyObservers(objController, true);
+ }
+
+ public String getFaction() {
+ synchronized(objectMutex) {
+ return faction;
+ }
+ }
+
+ public void setFaction(String faction) {
+ synchronized(objectMutex) {
+ this.faction = faction;
+ }
+ }
+
+ public int getFactionStatus() {
+ synchronized(objectMutex) {
+ return factionStatus;
+ }
+ }
+
+ public void setFactionStatus(int factionStatus) {
+ synchronized(objectMutex) {
+ this.factionStatus = factionStatus;
+ }
+ }
+
+ public float getHeight() {
+ synchronized(objectMutex) {
+ return height;
+ }
+ }
+
+ public void setHeight(float height) {
+ synchronized(objectMutex) {
+ this.height = height;
+ }
+ }
+
+ public int getBattleFatigue() {
+ synchronized(objectMutex) {
+ return battleFatigue;
+ }
+ }
+
+ public void setBattleFatigue(int battleFatigue) {
+ synchronized(objectMutex) {
+ this.battleFatigue = battleFatigue;
+ }
+ }
+
+ public long getStateBitmask() {
+ synchronized(objectMutex) {
+ return stateBitmask;
+ }
+ }
+
+ public void setStateBitmask(long stateBitmask) {
+ synchronized(objectMutex) {
+ this.stateBitmask = stateBitmask;
+ }
+
+ IoBuffer stateDelta = messageBuilder.buildStateDelta(stateBitmask);
+
+ notifyObservers(stateDelta, true);
+
+ }
+
+ public long getOwnerId() {
+ synchronized(objectMutex) {
+ return ownerId;
+ }
+ }
+
+ public void setOwnerId(long ownerId) {
+ synchronized(objectMutex) {
+ this.ownerId = ownerId;
+ }
+ }
+
+ public float getAccelerationMultiplierBase() {
+ synchronized(objectMutex) {
+ return accelerationMultiplierBase;
+ }
+ }
+
+ public void setAccelerationMultiplierBase(float accelerationMultiplierBase) {
+ synchronized(objectMutex) {
+ this.accelerationMultiplierBase = accelerationMultiplierBase;
+ }
+ }
+
+ public float getAccelerationMultiplierMod() {
+ synchronized(objectMutex) {
+ return accelerationMultiplierMod;
+ }
+ }
+
+ public void setAccelerationMultiplierMod(float accelerationMultiplierMod) {
+ synchronized(objectMutex) {
+ this.accelerationMultiplierMod = accelerationMultiplierMod;
+ }
+ }
+
+ public List getSkillMods() {
+ return skillMods;
+ }
+
+ public short getSkillModsUpdateCounter() {
+ synchronized(objectMutex) {
+ return (short) skillModsUpdateCounter;
+ }
+ }
+
+ public void setSkillModsUpdateCounter(short skillModsUpdateCounter) {
+ synchronized(objectMutex) {
+ this.skillModsUpdateCounter = skillModsUpdateCounter;
+ }
+ }
+
+
+ public float getSpeedMultiplierBase() {
+ synchronized(objectMutex) {
+ return speedMultiplierBase;
+ }
+ }
+
+ public void setSpeedMultiplierBase(float speedMultiplierBase) {
+ synchronized(objectMutex) {
+ this.speedMultiplierBase = speedMultiplierBase;
+ }
+ IoBuffer speedDelta = messageBuilder.buildSpeedModDelta(speedMultiplierBase);
+
+ notifyObservers(speedDelta, true);
+
+ }
+
+ public float getSpeedMultiplierMod() {
+ synchronized(objectMutex) {
+ return speedMultiplierMod;
+ }
+ }
+
+ public void setSpeedMultiplierMod(float speedMultiplierMod) {
+ synchronized(objectMutex) {
+ this.speedMultiplierMod = speedMultiplierMod;
+ }
+ }
+
+ public long getListenToId() {
+ synchronized(objectMutex) {
+ return listenToId;
+ }
+ }
+
+ public void setListenToId(long listenToId) {
+ synchronized(objectMutex) {
+ this.listenToId = listenToId;
+ }
+ }
+
+ public float getRunSpeed() {
+ synchronized(objectMutex) {
+ return runSpeed;
+ }
+ }
+
+ public void setRunSpeed(float runSpeed) {
+ synchronized(objectMutex) {
+ this.runSpeed = runSpeed;
+ }
+ }
+
+ public float getSlopeModAngle() {
+ synchronized(objectMutex) {
+ return slopeModAngle;
+ }
+ }
+
+ public void setSlopeModAngle(float slopeModAngle) {
+ synchronized(objectMutex) {
+ this.slopeModAngle = slopeModAngle;
+ }
+ }
+
+ public float getSlopeModPercent() {
+ synchronized(objectMutex) {
+ return slopeModPercent;
+ }
+ }
+
+ public void setSlopeModPercent(float slopeModPercent) {
+ synchronized(objectMutex) {
+ this.slopeModPercent = slopeModPercent;
+ }
+ }
+
+ public float getTurnRadius() {
+ synchronized(objectMutex) {
+ return turnRadius;
+ }
+ }
+
+ public void setTurnRadius(float turnRadius) {
+ synchronized(objectMutex) {
+ this.turnRadius = turnRadius;
+ }
+ IoBuffer turnDelta = messageBuilder.buildTurnRadiusDelta(turnRadius);
+
+ notifyObservers(turnDelta, true);
+
+ }
+
+ public float getWalkSpeed() {
+ synchronized(objectMutex) {
+ return walkSpeed;
+ }
+ }
+
+ public void setWalkSpeed(float walkSpeed) {
+ synchronized(objectMutex) {
+ this.walkSpeed = walkSpeed;
+ }
+ }
+
+ public float getWaterModPercent() {
+ synchronized(objectMutex) {
+ return waterModPercent;
+ }
+ }
+
+ public void setWaterModPercent(float waterModPercent) {
+ synchronized(objectMutex) {
+ this.waterModPercent = waterModPercent;
+ }
+ }
+
+ public List getAbilities() {
+ return abilities;
+ }
+
+ public int getAbilitiesUpdateCounter() {
+ synchronized(objectMutex) {
+ return abilitiesUpdateCounter;
+ }
+ }
+
+ public void setAbilitiesUpdateCounter(int abilitiesUpdateCounter) {
+ synchronized(objectMutex) {
+ this.abilitiesUpdateCounter = abilitiesUpdateCounter;
+ }
+ }
+
+ public List getMissionCriticalObjects() {
+ return missionCriticalObjects;
+ }
+
+ public List getDefendersList() {
+ return defendersList;
+ }
+
+ public byte getCombatFlag() {
+ synchronized(objectMutex) {
+ return combatFlag;
+ }
+ }
+
+ public void setCombatFlag(byte combatFlag) {
+ synchronized(objectMutex) {
+ this.combatFlag = combatFlag;
+ }
+ }
+
+ public short getLevel() {
+ synchronized(objectMutex) {
+ return level;
+ }
+ }
+
+ public void setLevel(short level) {
+ synchronized(objectMutex) {
+ this.level = level;
+ }
+ }
+
+ public String getCurrentAnimation() {
+ synchronized(objectMutex) {
+ return currentAnimation;
+ }
+ }
+
+ public void setCurrentAnimation(String currentAnimation) {
+ synchronized(objectMutex) {
+ this.currentAnimation = currentAnimation;
+ }
+ }
+
+ public String getMoodAnimation() {
+ synchronized(objectMutex) {
+ return moodAnimation;
+ }
+ }
+
+ public void setMoodAnimation(String moodAnimation) {
+ synchronized(objectMutex) {
+ this.moodAnimation = moodAnimation;
+ }
+ }
+
+ public long getWeaponId() {
+ synchronized(objectMutex) {
+ return weaponId;
+ }
+ }
+
+ public void setWeaponId(long weaponId) {
+ synchronized(objectMutex) {
+ this.weaponId = weaponId;
+ }
+ }
+
+ public long getGroupId() {
+ synchronized(objectMutex) {
+ return groupId;
+ }
+ }
+
+ public void setGroupId(long groupId) {
+ synchronized(objectMutex) {
+ this.groupId = groupId;
+ }
+ }
+
+ public long getInviteSenderId() {
+ synchronized(objectMutex) {
+ return inviteSenderId;
+ }
+ }
+
+ public void setInviteSenderId(long inviteSenderId) {
+ synchronized(objectMutex) {
+ this.inviteSenderId = inviteSenderId;
+ }
+ }
+
+ public String getInviteSenderName() {
+ synchronized(objectMutex) {
+ return inviteSenderName;
+ }
+ }
+
+ public void setInviteSenderName(String inviteSenderName) {
+ synchronized(objectMutex) {
+ this.inviteSenderName = inviteSenderName;
+ }
+ }
+
+ public int getGuildId() {
+ synchronized(objectMutex) {
+ return guildId;
+ }
+ }
+
+ public void setGuildId(int guildId) {
+ synchronized(objectMutex) {
+ this.guildId = guildId;
+ }
+ }
+
+ public long getTargetId() {
+ synchronized(objectMutex) {
+ return targetId;
+ }
+ }
+
+ public void setTargetId(long targetId) {
+ synchronized(objectMutex) {
+ this.targetId = targetId;
+ }
+ IoBuffer targetDelta = messageBuilder.buildTargetDelta(targetId);
+
+ notifyObservers(targetDelta, false);
+
+ }
+
+ public long getInviteCounter() {
+ synchronized(objectMutex) {
+ return inviteCounter;
+ }
+ }
+
+ public void setInviteCounter(long inviteCounter) {
+ synchronized(objectMutex) {
+ this.inviteCounter = inviteCounter;
+ }
+ }
+
+ public byte getMoodId() {
+ synchronized(objectMutex) {
+ return moodId;
+ }
+ }
+
+ public void setMoodId(byte moodId) {
+ synchronized(objectMutex) {
+ this.moodId = moodId;
+ }
+ }
+
+ public int getPerformanceCounter() {
+ synchronized(objectMutex) {
+ return performanceCounter;
+ }
+ }
+
+ public void setPerformanceCounter(int performanceCounter) {
+ synchronized(objectMutex) {
+ this.performanceCounter = performanceCounter;
+ }
+ }
+
+ public int getPerformanceId() {
+ synchronized(objectMutex) {
+ return performanceId;
+ }
+ }
+
+ public void setPerformanceId(int performanceId) {
+ synchronized(objectMutex) {
+ this.performanceId = performanceId;
+ }
+ }
+
+ public List getEquipmentList() {
+ return equipmentList;
+ }
+
+ public List getBuffList() {
+ return buffList;
+ }
+
+ public List getAppearanceEquipmentList() {
+ return appearanceEquipmentList;
+ }
+
+ public List getDuelList() {
+ return duelList;
+ }
+
+ public boolean isInDuelList(long objectId) {
+ if(duelList.contains(objectId))
+ return true;
+ return false;
+ }
+
+ public void addObjectToEquipList(SWGObject object) {
+ if(object instanceof TangibleObject || object instanceof WeaponObject) {
+ synchronized(objectMutex) {
+ equipmentList.add(object);
+ }
+ }
+ }
+
+ public void removeObjectFromEquipList(SWGObject object) {
+ if(object instanceof TangibleObject || object instanceof WeaponObject) {
+ synchronized(objectMutex) {
+ equipmentList.remove(object);
+ }
+ }
+ }
+
+
+ @Override
+ public void sendBaselines(Client destination) {
+
+ if(destination == null || destination.getSession() == null) {
+ System.out.println("NULL session");
+ return;
+ }
+
+ destination.getSession().write(messageBuilder.buildBaseline3());
+ destination.getSession().write(messageBuilder.buildBaseline6());
+ if(destination == getClient()) {
+ destination.getSession().write(messageBuilder.buildBaseline1());
+ destination.getSession().write(messageBuilder.buildBaseline4());
+ }
+ //destination.getSession().write(messageBuilder.buildBaseline8());
+ //destination.getSession().write(messageBuilder.buildBaseline9());
+
+ UpdatePostureMessage upm = new UpdatePostureMessage(getObjectID(), getPosture());
+ destination.getSession().write(upm.serialize());
+ if(destination != getClient()) {
+ UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID(), 55);
+ destination.getSession().write(upvpm.serialize());
+ }
+
+
+ }
+
+ public void sendSystemMessage(String message, byte displayType) {
+
+ if(getClient() != null && getClient().getSession() != null) {
+ ChatSystemMessage systemMsg = new ChatSystemMessage(message, displayType);
+ getClient().getSession().write(systemMsg.serialize());
+ }
+
+ }
+
+}
diff --git a/src/resources/objects/factorycrate/FactoryCrateMessageBuilder.java b/src/resources/objects/factorycrate/FactoryCrateMessageBuilder.java
new file mode 100644
index 00000000..dbb1e565
--- /dev/null
+++ b/src/resources/objects/factorycrate/FactoryCrateMessageBuilder.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.factorycrate;
+
+public class FactoryCrateMessageBuilder {
+
+}
diff --git a/src/resources/objects/factorycrate/FactoryCrateObject.java b/src/resources/objects/factorycrate/FactoryCrateObject.java
new file mode 100644
index 00000000..5c5737ad
--- /dev/null
+++ b/src/resources/objects/factorycrate/FactoryCrateObject.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.factorycrate;
+
+public class FactoryCrateObject {
+
+}
diff --git a/src/resources/objects/group/GroupMessageBuilder.java b/src/resources/objects/group/GroupMessageBuilder.java
new file mode 100644
index 00000000..e23f3ee6
--- /dev/null
+++ b/src/resources/objects/group/GroupMessageBuilder.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.group;
+
+public class GroupMessageBuilder {
+
+}
diff --git a/src/resources/objects/group/GroupObject.java b/src/resources/objects/group/GroupObject.java
new file mode 100644
index 00000000..2d4de4bd
--- /dev/null
+++ b/src/resources/objects/group/GroupObject.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.group;
+
+import java.util.Vector;
+
+import engine.clients.Client;
+import engine.resources.objects.SWGObject;
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+
+
+public class GroupObject extends SWGObject {
+
+ private Vector memberList = new Vector();
+ private int memberListUpdateCounter;
+ private SWGObject groupLeader;
+ private SWGObject lootMaster;
+ private short groupLevel;
+ private int lootMode;
+
+ public GroupObject(long objectId) {
+ super(objectId, null, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1), "object/group/shared_group_object.iff");
+ }
+
+ public Vector getMemberList() {
+ return memberList;
+ }
+
+ public int getMemberListUpdateCounter() {
+ synchronized(objectMutex) {
+ return memberListUpdateCounter;
+ }
+ }
+
+ public void setMemberListUpdateCounter(int memberListUpdateCounter) {
+ synchronized(objectMutex) {
+ this.memberListUpdateCounter = memberListUpdateCounter;
+ }
+ }
+
+ public SWGObject getGroupLeader() {
+ synchronized(objectMutex) {
+ return groupLeader;
+ }
+ }
+
+ public void setGroupLeader(SWGObject groupLeader) {
+ synchronized(objectMutex) {
+ this.groupLeader = groupLeader;
+ }
+ }
+
+ public SWGObject getLootMaster() {
+ synchronized(objectMutex) {
+ return lootMaster;
+ }
+ }
+
+ public void setLootMaster(SWGObject lootMaster) {
+ synchronized(objectMutex) {
+ this.lootMaster = lootMaster;
+ }
+ }
+
+ public short getGroupLevel() {
+ synchronized(objectMutex) {
+ return groupLevel;
+ }
+ }
+
+ public void setGroupLevel(short groupLevel) {
+ synchronized(objectMutex) {
+ this.groupLevel = groupLevel;
+ }
+ }
+
+ public int getLootMode() {
+ synchronized(objectMutex) {
+ return lootMode;
+ }
+ }
+
+ public void setLootMode(int lootMode) {
+ synchronized(objectMutex) {
+ this.lootMode = lootMode;
+ }
+ }
+
+ @Override
+ public void sendBaselines(Client client) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/resources/objects/guild/GuildMessageBuilder.java b/src/resources/objects/guild/GuildMessageBuilder.java
new file mode 100644
index 00000000..b18a86e0
--- /dev/null
+++ b/src/resources/objects/guild/GuildMessageBuilder.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.guild;
+
+public class GuildMessageBuilder {
+
+}
diff --git a/src/resources/objects/guild/GuildObject.java b/src/resources/objects/guild/GuildObject.java
new file mode 100644
index 00000000..3c80b9dd
--- /dev/null
+++ b/src/resources/objects/guild/GuildObject.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.guild;
+
+public class GuildObject {
+
+}
diff --git a/src/resources/objects/harvester/HarvesterMessageBuilder.java b/src/resources/objects/harvester/HarvesterMessageBuilder.java
new file mode 100644
index 00000000..3b6c4602
--- /dev/null
+++ b/src/resources/objects/harvester/HarvesterMessageBuilder.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.harvester;
+
+public class HarvesterMessageBuilder {
+
+}
diff --git a/src/resources/objects/harvester/HarvesterObject.java b/src/resources/objects/harvester/HarvesterObject.java
new file mode 100644
index 00000000..1f7c48eb
--- /dev/null
+++ b/src/resources/objects/harvester/HarvesterObject.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.harvester;
+
+public class HarvesterObject {
+
+}
diff --git a/src/resources/objects/installation/InstallationMessageBuilder.java b/src/resources/objects/installation/InstallationMessageBuilder.java
new file mode 100644
index 00000000..f7902d4e
--- /dev/null
+++ b/src/resources/objects/installation/InstallationMessageBuilder.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.installation;
+
+public class InstallationMessageBuilder {
+
+}
diff --git a/src/resources/objects/installation/InstallationObject.java b/src/resources/objects/installation/InstallationObject.java
new file mode 100644
index 00000000..7b31ff63
--- /dev/null
+++ b/src/resources/objects/installation/InstallationObject.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.installation;
+
+public class InstallationObject {
+
+}
diff --git a/src/resources/objects/intangible/IntangibleMessageBuilder.java b/src/resources/objects/intangible/IntangibleMessageBuilder.java
new file mode 100644
index 00000000..1dd0af60
--- /dev/null
+++ b/src/resources/objects/intangible/IntangibleMessageBuilder.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.intangible;
+
+public class IntangibleMessageBuilder {
+
+}
diff --git a/src/resources/objects/intangible/IntangibleObject.java b/src/resources/objects/intangible/IntangibleObject.java
new file mode 100644
index 00000000..1d23fe40
--- /dev/null
+++ b/src/resources/objects/intangible/IntangibleObject.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.intangible;
+
+
+
+import com.sleepycat.persist.model.Persistent;
+
+import engine.clients.Client;
+import engine.resources.objects.SWGObject;
+import engine.resources.scene.Planet;
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+
+@Persistent
+public class IntangibleObject extends SWGObject {
+
+ private int genericInt;
+
+ public IntangibleObject() {
+ super();
+ }
+
+ public IntangibleObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
+ super(objectID, planet, position, orientation, Template);
+ }
+
+ public int getGenericInt() {
+ synchronized(objectMutex) {
+ return genericInt;
+ }
+ }
+
+ public void setGenericInt(int genericInt) {
+ synchronized(objectMutex) {
+ this.genericInt = genericInt;
+ }
+ }
+
+ @Override
+ public void sendBaselines(Client client) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/resources/objects/mission/MissionMessageBuilder.java b/src/resources/objects/mission/MissionMessageBuilder.java
new file mode 100644
index 00000000..90c78dfe
--- /dev/null
+++ b/src/resources/objects/mission/MissionMessageBuilder.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.mission;
+
+public class MissionMessageBuilder {
+
+}
diff --git a/src/resources/objects/mission/MissionObject.java b/src/resources/objects/mission/MissionObject.java
new file mode 100644
index 00000000..57c7540e
--- /dev/null
+++ b/src/resources/objects/mission/MissionObject.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.mission;
+
+public class MissionObject {
+
+}
diff --git a/src/resources/objects/player/PlayerMessageBuilder.java b/src/resources/objects/player/PlayerMessageBuilder.java
new file mode 100644
index 00000000..ac288553
--- /dev/null
+++ b/src/resources/objects/player/PlayerMessageBuilder.java
@@ -0,0 +1,402 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.player;
+
+import java.nio.ByteOrder;
+import java.util.Map.Entry;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import engine.resources.objects.ObjectMessageBuilder;
+
+import resources.objects.waypoint.WaypointObject;
+
+public class PlayerMessageBuilder extends ObjectMessageBuilder {
+
+ public static final String SPY = "spy_1a";
+ public static final String SMUGGLER = "smuggler_1a";
+ public static final String OFFICER = "officer_1a";
+ public static final String JEDI = "force_sensitive_1a";
+ public static final String COMMANDO = "commando_1a";
+ public static final String ENTERTAINER = "entertainer_1a";
+ public static final String MEDIC = "medic_1a";
+ public static final String BOUNTYHUNTER = "bounty_hunter_1a";
+
+
+ public PlayerMessageBuilder(PlayerObject playerObject) {
+ setObject(playerObject);
+ }
+
+ public IoBuffer buildBaseline3() {
+
+ PlayerObject player = (PlayerObject) object;
+
+ IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.setAutoExpand(true);
+ buffer.putShort((short) 0x14);
+ buffer.putFloat(1);
+ buffer.put(getAsciiString("string_id_table"));
+ buffer.putInt(0); // spacer
+ buffer.putShort((short) 0);
+ buffer.putInt(0); // custom name
+ buffer.putInt(0); // volume
+ buffer.putInt(0); // generic int
+
+ buffer.putInt(4); // flag bitmask list size
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putInt(0);
+
+ buffer.putInt(4); // profile bitmask list size
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putInt(0);
+
+ if(player.getTitle() == null || player.getTitle().length() < 1)
+ buffer.putShort((short) 0);
+ else
+ buffer.put(getAsciiString(player.getTitle()));
+
+ buffer.putInt(0); // born date?
+
+ buffer.putInt(0); // total play time?
+
+ buffer.putInt(getProfData(player.getProfession())); // prof icon
+
+ buffer.put(getAsciiString(player.getProfession()));
+ buffer.putInt(0); // unk
+ buffer.putInt(0); // unk
+
+ byte[] data1 = new byte[] {
+
+ 0x76, (byte) 0x0C, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xCF, (byte) 0x07, (byte) 0x00, (byte) 0x00, (byte) 0x78, (byte) 0x3E, (byte) 0x00, (byte) 0x00, (byte) 0x0F, (byte) 0x00, (byte) 0x60, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x41, (byte) 0x02, (byte) 0x88, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x1F, (byte) 0x20, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x84, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x40, (byte) 0x01, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
+ };
+ buffer.put(data1);
+ byte[] data2 = new byte[] {
+
+ 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xC0, (byte) 0x05, (byte) 0x04, (byte) 0x78, (byte) 0x34, (byte) 0x78, (byte) 0x78, (byte) 0x08, (byte) 0x08, (byte) 0x14, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x00, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0A, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x40, (byte) 0x04, (byte) 0x00, (byte) 0x20, (byte) 0x81, (byte) 0x0A, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0B, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x60, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0xC0, (byte) 0xFF, (byte) 0xC7, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x30, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x20, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
+ };
+ buffer.put(data2);
+ byte[] data3 = new byte[] {
+
+ 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0xCB, (byte) 0x32, (byte) 0x06, (byte) 0x18, (byte) 0x60, (byte) 0x0C, (byte) 0x30, (byte) 0x60, (byte) 0x2D, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
+ };
+ buffer.put(data3);
+ byte[] data4 = new byte[] {
+
+ 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
+ };
+ buffer.put(data4);
+ byte[] data5 = new byte[] {
+
+ 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xC0, (byte) 0xFF, (byte) 0x1F, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xD0, (byte) 0xD5, (byte) 0x68, (byte) 0x00, (byte) 0x1A, (byte) 0x46, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x30, (byte) 0x1A, (byte) 0x00, (byte) 0x00, (byte) 0x40, (byte) 0x03, (byte) 0xD0, (byte) 0x00, (byte) 0x34, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
+ };
+ buffer.put(data5);
+ byte[] data6 = new byte[] {
+
+ 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
+ };
+ buffer.put(data6);
+ byte[] data7 = new byte[] {
+
+ 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0xFF, (byte) 0x3F, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x00, (byte) 0x00
+ };
+ buffer.put(data7);
+
+
+ int size = buffer.position();
+
+ buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
+
+
+ buffer.flip();
+ buffer = createBaseline("PLAY", (byte) 3, buffer, size);
+
+ return buffer;
+
+ }
+
+ public IoBuffer buildBaseline6() {
+
+ PlayerObject player = (PlayerObject) object;
+
+ IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.setAutoExpand(true);
+ buffer.putShort((short) 0x11);
+ buffer.putInt((short) 0x8A);
+
+ buffer.put(getAsciiString("string_id_table"));
+
+ buffer.put((byte) 0); // unk
+ buffer.putShort((short) 0); // unk
+ buffer.putInt(0); // unk
+ buffer.putInt(0); // unk
+ buffer.putInt(0); // unk
+ buffer.putInt(0); // unk
+ buffer.putInt(0); // unk
+ buffer.putInt(0); // unk
+ if(player.getHome() == null || player.getHome().length() < 1) {
+ buffer.putShort((short) 0);
+ } else {
+ buffer.put(getAsciiString(player.getHome()));
+ }
+ buffer.putInt(0); // unk
+ buffer.put((byte) 0); // unk
+ buffer.putInt(0); // unk
+ buffer.putInt(0); // unk
+ buffer.putInt(0); // unk
+ buffer.putInt(0); // unk
+ buffer.putInt(0); // unk
+ buffer.putInt(0); // unk
+
+ int size = buffer.position();
+
+
+
+ buffer.flip();
+ buffer = createBaseline("PLAY", (byte) 6, buffer, size);
+
+ return buffer;
+
+ }
+
+ public IoBuffer buildBaseline8() {
+
+ PlayerObject player = (PlayerObject) object;
+
+ IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.setAutoExpand(true);
+ buffer.putShort((short) 0x09);
+
+ if(player.getXpList().isEmpty()) {
+ buffer.putInt(0);
+ buffer.putInt(0);
+ } else {
+ buffer.putInt(player.getXpList().size());
+ buffer.putInt(0);
+
+ // no need for locking here, concurrent hash map iterator wont throw concurrency exceptions and multiple thread access at zone in is unlikely to occur for the PlayerObject
+ for(Entry entry : player.getXpList().entrySet()) {
+
+ buffer.put((byte) 0);
+ buffer.put(getAsciiString(entry.getKey()));
+ buffer.putInt(entry.getValue());
+
+ }
+
+ }
+
+ if(player.getWaypoints().isEmpty()) {
+ buffer.putInt(0);
+ buffer.putInt(0);
+ } else {
+ buffer.putInt(player.getWaypoints().size());
+ buffer.putInt(0);
+
+ synchronized(player.getWaypoints()) {
+
+ for(WaypointObject waypoint : player.getWaypoints()) {
+
+ buffer.put((byte) 0);
+ buffer.putLong(waypoint.getObjectID());
+ buffer.putInt(waypoint.getCellId());
+ buffer.putFloat(waypoint.getPosition().x);
+ buffer.putFloat(waypoint.getPosition().y);
+ buffer.putFloat(waypoint.getPosition().z);
+ buffer.putLong(waypoint.getLocationNetworkId());
+ buffer.putInt(waypoint.getPlanetCRC());
+ buffer.put(getUnicodeString(waypoint.getName()));
+ buffer.putLong(waypoint.getObjectID());
+ buffer.put(waypoint.getColor());
+ buffer.put((byte) (waypoint.isActive() ? 1 : 0));
+
+ }
+
+ }
+ }
+
+ buffer.putInt(100); // Current force power ?
+ buffer.putInt(100); // Max force power ?
+ buffer.putInt(0); // Current FS Quest List size ?
+ buffer.putInt(0); // Current FS Quest List update counter ?
+
+ buffer.putInt(0); // Completed FS Quest List size ?
+ buffer.putInt(0); // Completed FS Quest List update counter ?
+
+ buffer.putInt(0); // Quest Journal List size ?
+ buffer.putInt(0); // Quest Journal List update counter ?
+
+ buffer.putInt(0); // unk
+
+ buffer.put(getAsciiString(player.getProfessionWheelPosition()));
+ int size = buffer.position();
+ buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
+
+ buffer.flip();
+ buffer = createBaseline("PLAY", (byte) 8, buffer, size);
+
+ return buffer;
+
+}
+
+ public IoBuffer buildBaseline9() {
+
+ PlayerObject player = (PlayerObject) object;
+
+ IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.setAutoExpand(true);
+
+ buffer.putShort((short) 0x1F);
+
+ buffer.putInt(0); // ExperimentationFlag?
+ buffer.putInt(0); // CraftingStage?
+
+ buffer.putLong(0); // Nearest Crafting Station id ?
+
+
+ buffer.putInt(0); // Draft Schematic List Size
+ buffer.putInt(0); // Draft Schematic List update counter
+
+ buffer.putInt(0); // ExperimentationPoints?
+ buffer.putInt(0); // CraftingStage?
+
+ buffer.putInt(8); // unk
+
+ buffer.putInt(0); // unk
+
+ if(player.getFriendList().isEmpty()) {
+ buffer.putInt(0);
+ buffer.putInt(0);
+ } else {
+ buffer.putInt(player.getFriendList().size());
+ buffer.putInt(player.getFriendListUpdateCounter());
+
+ synchronized(player.getFriendList()) {
+
+ for(String friend : player.getFriendList()) {
+ buffer.put(getAsciiString(friend));
+ }
+
+ }
+ }
+
+ if(player.getIgnoreList().isEmpty()) {
+ buffer.putInt(0);
+ buffer.putInt(0);
+ } else {
+ buffer.putInt(player.getIgnoreList().size());
+ buffer.putInt(player.getIgnoreListUpdateCounter());
+
+ synchronized(player.getIgnoreList()) {
+
+ for(String ignored : player.getIgnoreList()) {
+ buffer.put(getAsciiString(ignored));
+ }
+
+ }
+ }
+
+ buffer.putInt(1);
+ buffer.putInt(0); // Current stomach unused in NGE
+ buffer.putInt(0x64); // Max stomach unused in NGE
+ buffer.putInt(0); // Current drink unused in NGE
+ buffer.putInt(0x64); // Max drink unused in NGE
+ buffer.putInt(0); // Current consumable unused in NGE
+ buffer.putInt(0x64); // Max consumable unused in NGE
+
+ buffer.putInt(0);
+ buffer.putInt(0);
+
+ buffer.putInt(0);
+ buffer.putInt(3);
+ buffer.putInt(0);
+ buffer.putInt(0);
+
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putInt(0);
+
+ buffer.putInt(0);
+ buffer.putInt(2);
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putInt(0);
+
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putInt(0);
+
+ buffer.putInt(4); // jedi state???
+ buffer.putShort((short) 0);
+ int size = buffer.position();
+
+ buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
+
+
+ buffer.flip();
+ buffer = createBaseline("PLAY", (byte) 9, buffer, size);
+
+ return buffer;
+
+ }
+
+ public int getProfData(String profession) {
+
+ switch (profession) {
+
+ case SPY:
+ return 0x23;
+ case SMUGGLER:
+ return 0x19;
+ case OFFICER:
+ return 0x0F;
+ case JEDI:
+ return 0x28;
+ case COMMANDO:
+ return 0x1E;
+ case ENTERTAINER:
+ return 0x05;
+ case MEDIC:
+ return 0x0A;
+ case BOUNTYHUNTER:
+ return 0x14;
+ default:
+ return 0x00;
+
+ }
+ }
+
+
+
+ @Override
+ public void sendBaselines() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java
new file mode 100644
index 00000000..45e2e9a0
--- /dev/null
+++ b/src/resources/objects/player/PlayerObject.java
@@ -0,0 +1,463 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.player;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import resources.objects.waypoint.WaypointObject;
+
+
+import com.sleepycat.persist.model.NotPersistent;
+import com.sleepycat.persist.model.Persistent;
+
+import engine.clients.Client;
+import engine.resources.objects.DraftSchematic;
+import engine.resources.objects.Quest;
+import engine.resources.objects.SWGObject;
+import engine.resources.scene.Planet;
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+
+@Persistent
+public class PlayerObject extends SWGObject {
+
+ // PLAY 3
+
+ private String title;
+ private String profession;
+ private List flagsList = new ArrayList();
+ private List profileList = new ArrayList();
+ private int bornDate = 0;
+ private int totalPlayTime = 0;
+
+ // PLAY 6
+
+ private String home; // Player City Name
+
+ // PLAY 8
+
+ private Map xpList = new HashMap();
+ @NotPersistent
+ private int xpListUpdateCounter = 0;
+
+ private List waypoints = new ArrayList();
+ @NotPersistent
+ private int waypointListUpdateCounter = 0;
+
+ private int currentForcePower = 0; // unused in NGE
+ private int maxForcePower = 0; // unused in NGE
+
+ private List currentFSQuestList = new ArrayList(); // unused in NGE
+ private List completedFSQuestList = new ArrayList(); // unused in NGE
+
+ private List questJournal = new ArrayList();
+ @NotPersistent
+ private int questJournalUpdateCounter = 0;
+
+ private String professionWheelPosition;
+
+ // PLAY 9
+
+ private int experimentationFlag = 0;
+ private int craftingStage = 0;
+ private long nearestCraftingStation = 0;
+
+ private List draftSchematicList = new ArrayList();
+ @NotPersistent
+ private int draftSchematicListUpdateCounter = 0;
+
+ private int experimentationPoints = 0;
+ private int accomplishmentCounter = 0;
+
+ private List friendList = new ArrayList();
+ @NotPersistent
+ private int friendListUpdateCounter = 0;
+ private List ignoreList = new ArrayList();
+ @NotPersistent
+ private int ignoreListUpdateCounter = 0;
+
+ private int languageId = 0; // unused in NGE
+ private int currentStomach = 0; // unused in NGE
+ private int maxStomach = 0; // unused in NGE
+ private int currentDrink = 0; // unused in NGE
+ private int maxDrink = 0; // unused in NGE
+ private int currentConsumable = 0; // unused
+ private int maxConsumable = 0; // unused
+
+ // TODO: research new NGE vars between maxConsumable and jediState
+
+ private int jediState = 0; // unused in NGE
+
+ @NotPersistent
+ private PlayerMessageBuilder messageBuilder;
+
+
+
+ public PlayerObject() {
+ super();
+ messageBuilder = new PlayerMessageBuilder(this);
+ }
+
+ public PlayerObject(long objectID, Planet planet) {
+ super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), "object/player/shared_player.iff");
+ messageBuilder = new PlayerMessageBuilder(this);
+ }
+
+ public String getTitle() {
+ synchronized(objectMutex) {
+ return title;
+ }
+ }
+
+ public void setTitle(String title) {
+ synchronized(objectMutex) {
+ this.title = title;
+ }
+ }
+
+ public String getProfession() {
+ synchronized(objectMutex) {
+ return profession;
+ }
+ }
+
+ public void setProfession(String profession) {
+ synchronized(objectMutex) {
+ this.profession = profession;
+ }
+ }
+
+ public List getFlagsList() {
+ return flagsList;
+ }
+
+ public List getProfileList() {
+ return profileList;
+ }
+
+ public int getBornDate() {
+ synchronized(objectMutex) {
+ return bornDate;
+ }
+ }
+
+ public void setBornDate(int bornDate) {
+ synchronized(objectMutex) {
+ this.bornDate = bornDate;
+ }
+ }
+
+ public int getTotalPlayTime() {
+ synchronized(objectMutex) {
+ return totalPlayTime;
+ }
+ }
+
+ public void setTotalPlayTime(int totalPlayTime) {
+ synchronized(objectMutex) {
+ this.totalPlayTime = totalPlayTime;
+ }
+ }
+
+ public String getHome() {
+ synchronized(objectMutex) {
+ return home;
+ }
+ }
+
+ public void setHome(String home) {
+ synchronized(objectMutex) {
+ this.home = home;
+ }
+ }
+
+ public Map getXpList() {
+ return xpList;
+ }
+
+ public List getWaypoints() {
+ return waypoints;
+ }
+
+ public int getCurrentForcePower() {
+ synchronized(objectMutex) {
+ return currentForcePower;
+ }
+ }
+
+ public void setCurrentForcePower(int currentForcePower) {
+ synchronized(objectMutex) {
+ this.currentForcePower = currentForcePower;
+ }
+ }
+
+ public int getMaxForcePower() {
+ synchronized(objectMutex) {
+ return maxForcePower;
+ }
+ }
+
+ public void setMaxForcePower(int maxForcePower) {
+ synchronized(objectMutex) {
+ this.maxForcePower = maxForcePower;
+ }
+ }
+
+ public List getCurrentFSQuestList() {
+ return currentFSQuestList;
+ }
+
+ public List getCompletedFSQuestList() {
+ return completedFSQuestList;
+ }
+
+ public List getQuestJournal() {
+ return questJournal;
+ }
+
+ public String getProfessionWheelPosition() {
+ synchronized(objectMutex) {
+ return professionWheelPosition;
+ }
+ }
+
+ public void setProfessionWheelPosition(String professionWheelPosition) {
+ synchronized(objectMutex) {
+ this.professionWheelPosition = professionWheelPosition;
+ }
+ }
+
+ public int getExperimentationFlag() {
+ synchronized(objectMutex) {
+ return experimentationFlag;
+ }
+ }
+
+ public void setExperimentationFlag(int experimentationFlag) {
+ synchronized(objectMutex) {
+ this.experimentationFlag = experimentationFlag;
+ }
+ }
+
+ public int getCraftingStage() {
+ synchronized(objectMutex) {
+ return craftingStage;
+ }
+ }
+
+ public void setCraftingStage(int craftingStage) {
+ synchronized(objectMutex) {
+ this.craftingStage = craftingStage;
+ }
+ }
+
+ public long getNearestCraftingStation() {
+ synchronized(objectMutex) {
+ return nearestCraftingStation;
+ }
+ }
+
+ public void setNearestCraftingStation(long nearestCraftingStation) {
+ synchronized(objectMutex) {
+ this.nearestCraftingStation = nearestCraftingStation;
+ }
+ }
+
+ public List getDraftSchematicList() {
+ return draftSchematicList;
+ }
+
+ public int getExperimentationPoints() {
+ synchronized(objectMutex) {
+ return experimentationPoints;
+ }
+ }
+
+ public void setExperimentationPoints(int experimentationPoints) {
+ synchronized(objectMutex) {
+ this.experimentationPoints = experimentationPoints;
+ }
+ }
+
+ public int getAccomplishmentCounter() {
+ synchronized(objectMutex) {
+ return accomplishmentCounter;
+ }
+ }
+
+ public void setAccomplishmentCounter(int accomplishmentCounter) {
+ synchronized(objectMutex) {
+ this.accomplishmentCounter = accomplishmentCounter;
+ }
+ }
+
+ public List getFriendList() {
+ return friendList;
+ }
+
+ public int getFriendListUpdateCounter() {
+ synchronized(objectMutex) {
+ return friendListUpdateCounter;
+ }
+ }
+
+ public void setFriendListUpdateCounter(int friendListUpdateCounter) {
+ synchronized(objectMutex) {
+ this.friendListUpdateCounter = friendListUpdateCounter;
+ }
+ }
+
+ public List getIgnoreList() {
+ return ignoreList;
+ }
+
+ public int getIgnoreListUpdateCounter() {
+ synchronized(objectMutex) {
+ return ignoreListUpdateCounter;
+ }
+ }
+
+ public void setIgnoreListUpdateCounter(int ignoreListUpdateCounter) {
+ synchronized(objectMutex) {
+ this.ignoreListUpdateCounter = ignoreListUpdateCounter;
+ }
+ }
+
+
+ public int getLanguageId() {
+ synchronized(objectMutex) {
+ return languageId;
+ }
+ }
+
+ public void setLanguageId(int languageId) {
+ synchronized(objectMutex) {
+ this.languageId = languageId;
+ }
+ }
+
+ public int getCurrentStomach() {
+ synchronized(objectMutex) {
+ return currentStomach;
+ }
+ }
+
+ public void setCurrentStomach(int currentStomach) {
+ synchronized(objectMutex) {
+ this.currentStomach = currentStomach;
+ }
+ }
+
+ public int getMaxStomach() {
+ synchronized(objectMutex) {
+ return maxStomach;
+ }
+ }
+
+ public void setMaxStomach(int maxStomach) {
+ synchronized(objectMutex) {
+ this.maxStomach = maxStomach;
+ }
+ }
+
+ public int getCurrentDrink() {
+ synchronized(objectMutex) {
+ return currentDrink;
+ }
+ }
+
+ public void setCurrentDrink(int currentDrink) {
+ synchronized(objectMutex) {
+ this.currentDrink = currentDrink;
+ }
+ }
+
+ public int getMaxDrink() {
+ synchronized(objectMutex) {
+ return maxDrink;
+ }
+ }
+
+ public void setMaxDrink(int maxDrink) {
+ synchronized(objectMutex) {
+ this.maxDrink = maxDrink;
+ }
+ }
+
+ public int getCurrentConsumable() {
+ synchronized(objectMutex) {
+ return currentConsumable;
+ }
+ }
+
+ public void setCurrentConsumable(int currentConsumable) {
+ synchronized(objectMutex) {
+ this.currentConsumable = currentConsumable;
+ }
+ }
+
+ public int getMaxConsumable() {
+ synchronized(objectMutex) {
+ return maxConsumable;
+ }
+ }
+
+ public void setMaxConsumable(int maxConsumable) {
+ synchronized(objectMutex) {
+ this.maxConsumable = maxConsumable;
+ }
+ }
+
+ public int getJediState() {
+ synchronized(objectMutex) {
+ return jediState;
+ }
+ }
+
+ public void setJediState(int jediState) {
+ synchronized(objectMutex) {
+ this.jediState = jediState;
+ }
+ }
+
+ @Override
+ public void sendBaselines(Client destination) {
+
+ if(destination == null || destination.getSession() == null)
+ return;
+
+ if(destination.getParent().getObjectID() == getParentId()) { // only send to self
+ destination.getSession().write(messageBuilder.buildBaseline3());
+ destination.getSession().write(messageBuilder.buildBaseline6());
+ destination.getSession().write(messageBuilder.buildBaseline8());
+ destination.getSession().write(messageBuilder.buildBaseline9());
+ }
+
+
+ }
+
+}
diff --git a/src/resources/objects/resource/ResourceContainerMessageBuilder.java b/src/resources/objects/resource/ResourceContainerMessageBuilder.java
new file mode 100644
index 00000000..7f517faa
--- /dev/null
+++ b/src/resources/objects/resource/ResourceContainerMessageBuilder.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.resource;
+
+public class ResourceContainerMessageBuilder {
+
+}
diff --git a/src/resources/objects/resource/ResourceContainerObject.java b/src/resources/objects/resource/ResourceContainerObject.java
new file mode 100644
index 00000000..cea47b84
--- /dev/null
+++ b/src/resources/objects/resource/ResourceContainerObject.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.resource;
+
+public class ResourceContainerObject {
+
+}
diff --git a/src/resources/objects/ship/ShipMessageBuilder.java b/src/resources/objects/ship/ShipMessageBuilder.java
new file mode 100644
index 00000000..b3874e8e
--- /dev/null
+++ b/src/resources/objects/ship/ShipMessageBuilder.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.ship;
+
+public class ShipMessageBuilder {
+
+}
diff --git a/src/resources/objects/ship/ShipObject.java b/src/resources/objects/ship/ShipObject.java
new file mode 100644
index 00000000..b27be2fa
--- /dev/null
+++ b/src/resources/objects/ship/ShipObject.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.ship;
+
+public class ShipObject {
+
+}
diff --git a/src/resources/objects/staticobject/StaticMessageBuilder.java b/src/resources/objects/staticobject/StaticMessageBuilder.java
new file mode 100644
index 00000000..7271a915
--- /dev/null
+++ b/src/resources/objects/staticobject/StaticMessageBuilder.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.staticobject;
+
+public class StaticMessageBuilder {
+
+}
diff --git a/src/resources/objects/staticobject/StaticObject.java b/src/resources/objects/staticobject/StaticObject.java
new file mode 100644
index 00000000..27c97db5
--- /dev/null
+++ b/src/resources/objects/staticobject/StaticObject.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.staticobject;
+
+import engine.clients.Client;
+import engine.resources.objects.SWGObject;
+import engine.resources.scene.Planet;
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+
+public class StaticObject extends SWGObject {
+
+ public StaticObject() {
+ super();
+ }
+
+ public StaticObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
+ super(objectID, planet, position, orientation, Template);
+ }
+
+ @Override
+ public void sendBaselines(Client client) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/src/resources/objects/tangible/TangibleMessageBuilder.java b/src/resources/objects/tangible/TangibleMessageBuilder.java
new file mode 100644
index 00000000..1c1fee9c
--- /dev/null
+++ b/src/resources/objects/tangible/TangibleMessageBuilder.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.tangible;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import engine.resources.objects.ObjectMessageBuilder;
+
+
+public class TangibleMessageBuilder extends ObjectMessageBuilder {
+
+ public TangibleMessageBuilder(TangibleObject tangible) {
+ setObject(tangible);
+ }
+
+ public IoBuffer buildBaseline3() {
+ TangibleObject tangible = (TangibleObject) object;
+ IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.setAutoExpand(true);
+
+ buffer.putShort((short) 0x0D);
+ buffer.putFloat(object.getComplexity());
+ buffer.put(getAsciiString(object.getStfFilename()));
+ buffer.putInt(0);
+ buffer.put(getAsciiString(object.getStfName()));
+
+ if(object.getCustomName() == null || object.getCustomName().length() < 1)
+ buffer.putInt(0);
+ else
+ buffer.put(getUnicodeString(object.getCustomName()));
+ buffer.putInt(object.getVolume());
+ buffer.putInt(0);
+ buffer.putInt(0); // unknowns
+
+ if(tangible.getCustomization() == null || tangible.getCustomization().length < 1)
+ buffer.putShort((short) 0);
+ else {
+ buffer.putShort((short) tangible.getCustomization().length);
+ buffer.put(tangible.getCustomization());
+ }
+ buffer.putInt(tangible.getOptionsBitmask());
+ buffer.putInt(tangible.getIncapTimer());
+ buffer.putInt(tangible.getConditionDamage());
+ buffer.putInt(tangible.getMaxDamage());
+ buffer.putInt(0);
+ buffer.putInt(0x64);
+ buffer.put((byte) (tangible.isStaticObject() ? 1 : 0));
+
+ int size = buffer.position();
+ buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
+
+ buffer.flip();
+ buffer = createBaseline("TANO", (byte) 3, buffer, size);
+
+ return buffer;
+ }
+
+ public IoBuffer buildBaseline6() {
+ TangibleObject tangible = (TangibleObject) object;
+ IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.setAutoExpand(true);
+ buffer.putShort((short) 8);
+ buffer.putInt(0x64);
+ buffer.put(getAsciiString(tangible.getDetailFilename()));
+ buffer.putInt(0);
+ buffer.put(getAsciiString(tangible.getDetailName()));
+ buffer.putLong(0);
+ buffer.putLong(0);
+ buffer.putLong(0); // unks
+ buffer.putLong(0);
+ buffer.putInt(0);
+ buffer.put((byte) 0);
+
+ int size = buffer.position();
+ buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
+
+ buffer.flip();
+ buffer = createBaseline("TANO", (byte) 6, buffer, size);
+
+ return buffer;
+ }
+
+ public IoBuffer buildBaseline8() {
+ IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.putShort((short) 0);
+ int size = buffer.position();
+ buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size);
+ buffer.flip();
+ buffer = createBaseline("TANO", (byte) 8, buffer, size);
+
+ return buffer;
+ }
+
+ public IoBuffer buildBaseline9() {
+ IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.putShort((short) 0);
+ int size = buffer.position();
+ buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size);
+ buffer.flip();
+ buffer = createBaseline("TANO", (byte) 9, buffer, size);
+
+ return buffer;
+ }
+
+ @Override
+ public void sendBaselines() {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java
new file mode 100644
index 00000000..8972d0ba
--- /dev/null
+++ b/src/resources/objects/tangible/TangibleObject.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.tangible;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+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;
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+
+
+@Persistent
+public class TangibleObject extends SWGObject {
+
+
+ // TODO: Thread safety
+
+ private int incapTimer = 10;
+ private int conditionDamage = 0;
+
+ private byte[] customization;
+ private List componentCustomizations = new ArrayList();
+ private int optionsBitmask = 0;
+ private int maxDamage = 0;
+ private boolean staticObject = false;
+ @NotPersistent
+ private TangibleMessageBuilder messageBuilder;
+
+ public TangibleObject(long objectID, Planet planet, String template) {
+ super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template);
+ messageBuilder = new TangibleMessageBuilder(this);
+ }
+
+ public TangibleObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) {
+ super(objectID, planet, position, orientation, template);
+ messageBuilder = new TangibleMessageBuilder(this);
+ }
+
+ public TangibleObject() {
+ super();
+ messageBuilder = new TangibleMessageBuilder(this);
+ }
+
+ public int getIncapTimer() {
+ return incapTimer;
+ }
+
+ public void setIncapTimer(int incapTimer) {
+ this.incapTimer = incapTimer;
+ }
+
+ public int getConditionDamage() {
+ return conditionDamage;
+ }
+
+ public void setConditionDamage(int conditionDamage) {
+ this.conditionDamage = conditionDamage;
+ }
+
+ public byte[] getCustomization() {
+ return customization;
+ }
+
+ public void setCustomization(byte[] customization) {
+ this.customization = customization;
+ }
+
+ public List getComponentCustomizations() {
+ return componentCustomizations;
+ }
+
+ public void setComponentCustomizations(List componentCustomizations) {
+ this.componentCustomizations = componentCustomizations;
+ }
+
+ public int getOptionsBitmask() {
+ return optionsBitmask;
+ }
+
+ public void setOptionsBitmask(int optionsBitmask) {
+ this.optionsBitmask = optionsBitmask;
+ }
+
+ public int getMaxDamage() {
+ return maxDamage;
+ }
+
+ public void setMaxDamage(int maxDamage) {
+ this.maxDamage = maxDamage;
+ }
+
+ public boolean isStaticObject() {
+ return staticObject;
+ }
+
+ public void setStaticObject(boolean staticObject) {
+ this.staticObject = staticObject;
+ }
+
+ @Override
+ public void sendBaselines(Client destination) {
+
+
+ if(destination == null || destination.getSession() == null)
+ return;
+
+ destination.getSession().write(messageBuilder.buildBaseline3());
+ destination.getSession().write(messageBuilder.buildBaseline6());
+ destination.getSession().write(messageBuilder.buildBaseline8());
+ destination.getSession().write(messageBuilder.buildBaseline9());
+
+
+ }
+
+}
diff --git a/src/resources/objects/waypoint/WaypointObject.java b/src/resources/objects/waypoint/WaypointObject.java
new file mode 100644
index 00000000..655c6a71
--- /dev/null
+++ b/src/resources/objects/waypoint/WaypointObject.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.waypoint;
+
+
+
+import com.sleepycat.persist.model.Persistent;
+
+import engine.clients.Client;
+import engine.resources.objects.SWGObject;
+import engine.resources.scene.Planet;
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+
+@Persistent
+public class WaypointObject extends SWGObject {
+
+ private int cellId; // ???
+ private long locationNetworkId;
+ private int planetCRC;
+ private String name;
+ private byte color;
+ private boolean isActive;
+
+ public static final byte BLUE = 1;
+ public static final byte GREEN = 2;
+ public static final byte ORANGE = 3;
+ public static final byte YELLOW = 4;
+ public static final byte PURPLE = 5;
+ public static final byte WHITE = 6;
+ public static final byte MULTICOLOR = 7; // JTL waypoint
+
+ public WaypointObject() { }
+
+ public WaypointObject(long objectID, Planet planet, Point3D position) {
+ super(objectID, planet, position, new Quaternion(0, 0, 0, 1), "object/waypoint/shared_waypoint.iff");
+ }
+
+ public int getCellId() {
+ synchronized(objectMutex) {
+ return cellId;
+ }
+ }
+
+
+ public void setCellId(int cellId) {
+ synchronized(objectMutex) {
+ this.cellId = cellId;
+ }
+ }
+
+
+ public long getLocationNetworkId() {
+ synchronized(objectMutex) {
+ return locationNetworkId;
+ }
+ }
+
+
+ public void setLocationNetworkId(long locationNetworkId) {
+ synchronized(objectMutex) {
+ this.locationNetworkId = locationNetworkId;
+ }
+ }
+
+
+ public int getPlanetCRC() {
+ synchronized(objectMutex) {
+ return planetCRC;
+ }
+ }
+
+
+ public void setPlanetCRC(int planetCRC) {
+ synchronized(objectMutex) {
+ this.planetCRC = planetCRC;
+ }
+ }
+
+
+ public String getName() {
+ synchronized(objectMutex) {
+ return name;
+ }
+ }
+
+
+ public void setName(String name) {
+ synchronized(objectMutex) {
+ this.name = name;
+ }
+ }
+
+
+ public byte getColor() {
+ synchronized(objectMutex) {
+ return color;
+ }
+ }
+
+
+ public void setColor(byte color) {
+ synchronized(objectMutex) {
+ this.color = color;
+ }
+ }
+
+
+ public boolean isActive() {
+ synchronized(objectMutex) {
+ return isActive;
+ }
+ }
+
+
+ public void setActive(boolean isActive) {
+ synchronized(objectMutex) {
+ this.isActive = isActive;
+ }
+ }
+
+ @Override
+ public void sendBaselines(Client client) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/resources/objects/weapon/WeaponMessageBuilder.java b/src/resources/objects/weapon/WeaponMessageBuilder.java
new file mode 100644
index 00000000..f59e3d43
--- /dev/null
+++ b/src/resources/objects/weapon/WeaponMessageBuilder.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.weapon;
+
+import java.nio.ByteOrder;
+
+import org.apache.mina.core.buffer.IoBuffer;
+
+import engine.resources.objects.ObjectMessageBuilder;
+
+
+public class WeaponMessageBuilder extends ObjectMessageBuilder {
+
+ public WeaponMessageBuilder(WeaponObject weaponObject) {
+ setObject(weaponObject);
+ }
+
+ public IoBuffer buildBaseline3() {
+ WeaponObject weapon = (WeaponObject) object;
+ IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.setAutoExpand(true);
+ buffer.putShort((short) 0x14);
+ buffer.putFloat(0);
+ buffer.put(getAsciiString(weapon.getStfFilename()));
+ buffer.putInt(0);
+ buffer.put(getAsciiString(weapon.getStfName()));
+ if(weapon.getCustomName() == null || weapon.getCustomName().length() < 1)
+ buffer.putInt(0);
+ else
+ buffer.put(getUnicodeString(weapon.getCustomName()));
+ buffer.putInt(object.getVolume());
+ buffer.putInt(0);
+ buffer.putInt(0); // unknowns
+ if(weapon.getCustomization() == null || weapon.getCustomization().length < 1)
+ buffer.putShort((short) 0);
+ else {
+ buffer.putShort((short) weapon.getCustomization().length);
+ buffer.put(weapon.getCustomization());
+ }
+ buffer.putInt(weapon.getOptionsBitmask());
+ buffer.putInt(weapon.getIncapTimer());
+ buffer.putInt(weapon.getConditionDamage());
+ buffer.putInt(weapon.getMaxDamage());
+ buffer.putInt(0);
+ buffer.putInt(0x64);
+ buffer.put((byte) (weapon.isStaticObject() ? 1 : 0));
+ buffer.putFloat(weapon.getAttackSpeed());
+ buffer.putInt(0);
+ buffer.putInt(0);
+ buffer.putShort((short) 0);
+ buffer.putInt(0x014280); // range 64m no idea how this converts to 64
+ buffer.putShort((short) 0);
+
+ buffer.putInt(0);
+ buffer.putInt(0); // those 2 ints have something to do with particle color
+
+
+ int size = buffer.position();
+ buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
+
+ buffer.flip();
+ buffer = createBaseline("WEAO", (byte) 3, buffer, size);
+
+ return buffer;
+ }
+
+ public IoBuffer buildBaseline6() {
+ WeaponObject weapon = (WeaponObject) object;
+ IoBuffer buffer = bufferPool.allocate(100, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.setAutoExpand(true);
+ buffer.putShort((short) 9);
+ buffer.putInt(0x4E);
+ buffer.put(getAsciiString(weapon.getDetailFilename()));
+ buffer.putInt(0);
+ buffer.put(getAsciiString(weapon.getDetailName()));
+ buffer.putLong(0);
+ buffer.putLong(0);
+ buffer.putLong(0); // unks
+ buffer.putLong(0);
+ buffer.putInt(0);
+ buffer.put((byte) 0);
+ buffer.putInt(weapon.getWeaponType());
+
+ int size = buffer.position();
+ buffer = bufferPool.allocate(size, false).put(buffer.array(), 0, size);
+
+ buffer.flip();
+ buffer = createBaseline("WEAO", (byte) 6, buffer, size);
+
+ return buffer;
+ }
+
+ public IoBuffer buildBaseline8() {
+ IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.putShort((short) 0);
+ int size = buffer.position();
+ buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size);
+
+ buffer.flip();
+ buffer = createBaseline("WEAO", (byte) 8, buffer, size);
+
+ return buffer;
+ }
+
+ public IoBuffer buildBaseline9() {
+ IoBuffer buffer = bufferPool.allocate(2, false).order(ByteOrder.LITTLE_ENDIAN);
+ buffer.putShort((short) 0);
+ int size = buffer.position();
+ buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size);
+
+ buffer.flip();
+ buffer = createBaseline("WEAO", (byte) 9, buffer, size);
+
+ return buffer;
+ }
+
+
+
+ @Override
+ public void sendBaselines() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/resources/objects/weapon/WeaponObject.java b/src/resources/objects/weapon/WeaponObject.java
new file mode 100644
index 00000000..6d893727
--- /dev/null
+++ b/src/resources/objects/weapon/WeaponObject.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package resources.objects.weapon;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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;
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+import resources.objects.tangible.TangibleMessageBuilder;
+
+@Persistent
+public class WeaponObject extends SWGObject {
+
+ // TODO: Thread safety
+
+ private int incapTimer = 10;
+ private int conditionDamage = 0;
+
+ private byte[] customization;
+ private List componentCustomizations = new ArrayList();
+ private int optionsBitmask = 0;
+ private int maxDamage = 0;
+ private boolean staticObject = true;
+ @NotPersistent
+ private WeaponMessageBuilder messageBuilder;
+
+ private float attackSpeed = 1;
+
+ public WeaponObject(long objectID, Planet planet, String template) {
+ super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template);
+ messageBuilder = new WeaponMessageBuilder(this);
+ }
+
+ public WeaponObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) {
+ super(objectID, planet, position, orientation, template);
+ messageBuilder = new WeaponMessageBuilder(this);
+ }
+
+
+ public WeaponObject() {
+ super();
+ messageBuilder = new WeaponMessageBuilder(this);
+ }
+
+ public int getIncapTimer() {
+ return incapTimer;
+ }
+
+ public void setIncapTimer(int incapTimer) {
+ this.incapTimer = incapTimer;
+ }
+
+ public int getConditionDamage() {
+ return conditionDamage;
+ }
+
+ public void setConditionDamage(int conditionDamage) {
+ this.conditionDamage = conditionDamage;
+ }
+
+ public byte[] getCustomization() {
+ return customization;
+ }
+
+ public void setCustomization(byte[] customization) {
+ this.customization = customization;
+ }
+
+ public List getComponentCustomizations() {
+ return componentCustomizations;
+ }
+
+ public void setComponentCustomizations(List componentCustomizations) {
+ this.componentCustomizations = componentCustomizations;
+ }
+
+ public int getOptionsBitmask() {
+ return optionsBitmask;
+ }
+
+ public void setOptionsBitmask(int optionsBitmask) {
+ this.optionsBitmask = optionsBitmask;
+ }
+
+ public int getMaxDamage() {
+ return maxDamage;
+ }
+
+ public void setMaxDamage(int maxDamage) {
+ this.maxDamage = maxDamage;
+ }
+
+ public boolean isStaticObject() {
+ return staticObject;
+ }
+
+ public void setStaticObject(boolean staticObject) {
+ this.staticObject = staticObject;
+ }
+
+ public int getWeaponType() {
+
+ int weaponType = -1;
+
+ String template = getTemplate();
+
+ if(template.contains("rifle")) weaponType = 0;
+ if(template.contains("carbine")) weaponType = 1;
+ if(template.contains("pistol")) weaponType = 2;
+ if(template.contains("heavy")) weaponType = 3;
+ if(template.contains("sword") || template.contains("baton")) weaponType = 4;
+ if(template.contains("2h_sword") || template.contains("axe")) weaponType = 5;
+ if(template.contains("unarmed")) weaponType = 6;
+ if(template.contains("polearm") || template.contains("lance")) weaponType = 7;
+ if(template.contains("thrown")) weaponType = 8;
+ if(template.contains("lightsaber_one_handed")) weaponType = 9;
+ if(template.contains("lightsaber_two_handed")) weaponType = 10;
+ if(template.contains("lightsaber_polearm")) weaponType = 11;
+
+ if(weaponType == -1)
+ weaponType = 6;
+
+ return weaponType;
+
+ }
+
+ @Override
+ public void sendBaselines(Client destination) {
+ if(destination == null || destination.getSession() == null)
+ return;
+
+ destination.getSession().write(messageBuilder.buildBaseline3());
+ destination.getSession().write(messageBuilder.buildBaseline6());
+ destination.getSession().write(messageBuilder.buildBaseline8());
+ destination.getSession().write(messageBuilder.buildBaseline9());
+
+
+ }
+
+ public float getAttackSpeed() {
+ return attackSpeed;
+ }
+
+ public void setAttackSpeed(float attackSpeed) {
+ this.attackSpeed = attackSpeed;
+ }
+
+ public WeaponMessageBuilder getMessageBuilder() {
+ return messageBuilder;
+ }
+
+}
diff --git a/src/services/AttributeService.java b/src/services/AttributeService.java
new file mode 100644
index 00000000..83c6eeba
--- /dev/null
+++ b/src/services/AttributeService.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services;
+
+public class AttributeService {
+
+}
diff --git a/src/services/CharacterService.java b/src/services/CharacterService.java
new file mode 100644
index 00000000..486b26ab
--- /dev/null
+++ b/src/services/CharacterService.java
@@ -0,0 +1,383 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services;
+
+import java.io.IOException;
+import java.nio.ByteOrder;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ScheduledExecutorService;
+
+import main.NGECore;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IoSession;
+
+import engine.clients.Client;
+import engine.resources.common.CRC;
+import engine.resources.common.Utilities;
+import engine.resources.container.NullPermissions;
+import engine.resources.database.DatabaseConnection;
+import engine.resources.objects.SWGObject;
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+import engine.resources.service.INetworkDispatch;
+import engine.resources.service.INetworkRemoteEvent;
+import resources.common.*;
+
+import protocol.swg.ClientCreateCharacter;
+import protocol.swg.ClientRandomNameRequest;
+import protocol.swg.ClientRandomNameResponse;
+import protocol.swg.ClientVerifyAndLockNameRequest;
+import protocol.swg.ClientVerifyAndLockNameResponse;
+import protocol.swg.CreateCharacterSuccess;
+import protocol.swg.HeartBeatMessage;
+import protocol.swg.LoginClusterStatus;
+import protocol.swg.LoginEnumCluster;
+
+
+import resources.objects.creature.CreatureObject;
+import resources.objects.player.PlayerObject;
+import resources.objects.tangible.TangibleObject;
+import resources.objects.weapon.WeaponObject;
+
+public class CharacterService implements INetworkDispatch {
+
+ @SuppressWarnings("unused")
+ private NGECore core;
+ @SuppressWarnings("unused")
+ private DatabaseConnection databaseConnection;
+ @SuppressWarnings("unused")
+ private DatabaseConnection databaseConnection2;
+ private engine.resources.common.NameGen nameGenerator;
+ private static final String allowedCharsRegex = "['-]?[A-Za-z]('[a-zA-Z]|-[a-zA-Z]|[a-zA-Z])*['-]?$";
+
+ public CharacterService(NGECore core) {
+
+ this.core = core;
+ this.databaseConnection = core.getDatabase1();
+ this.databaseConnection2 = core.getDatabase2();
+ try {
+ nameGenerator = new engine.resources.common.NameGen("names.txt");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) {
+
+ swgOpcodes.put(Opcodes.ClientRandomNameRequest, new INetworkRemoteEvent() {
+
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+ data = data.order(ByteOrder.LITTLE_ENDIAN);
+ ClientRandomNameRequest randomNameRequest = new ClientRandomNameRequest();
+ data.position(0);
+ randomNameRequest.deserialize(data);
+ String name;
+ if(randomNameRequest.getSharedRaceTemplate().contains("wookie")) {
+ name = nameGenerator.compose(4);
+ } else {
+ name = nameGenerator.compose(2) + " " + nameGenerator.compose(3);
+ }
+ ClientRandomNameResponse response = new ClientRandomNameResponse(randomNameRequest.getSharedRaceTemplate(), name);
+ session.write(response.serialize());
+ }
+ });
+
+ swgOpcodes.put(Opcodes.ClientVerifyAndLockNameRequest, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+ data = data.order(ByteOrder.LITTLE_ENDIAN);
+ data.position(0);
+ ClientVerifyAndLockNameRequest message = new ClientVerifyAndLockNameRequest();
+ message.deserialize(data);
+ String approved_flag = "name_approved";
+ boolean isDeclined = false;
+ String firstName = getfirstName(message.getName(), message.getRaceTemplate());
+ String lastName = getlastName(message.getName(), message.getRaceTemplate());
+ if(message.getName() != null) System.out.println(message.getName());
+
+ int length = firstName.length();
+ try {
+ if (checkForDuplicateName(firstName)) {
+
+ approved_flag = "name_declined_in_use";
+ isDeclined = true;
+ }
+ if ((!isDeclined) && (length < 3 || length > 15 || lastName.length() > 20)) {
+
+ approved_flag = "name_declined_racially_inappropriate";
+ isDeclined = true;
+ }
+
+ if (!isDeclined) {
+ String rv = checkForReservedName(firstName, lastName);
+ if (rv != null) {
+ approved_flag = rv;
+ isDeclined = true;
+ }
+ }
+
+ if (!isDeclined)
+ {
+ if (!firstName.matches(allowedCharsRegex) || (!lastName.matches(allowedCharsRegex) && lastName != "")) {
+ approved_flag = "name_declined_syntax";
+ isDeclined = true;
+
+ }
+ }
+
+ if (!isDeclined) {
+ approved_flag = "name_approved";
+ }
+
+ }
+ catch (SQLException e) {
+ e.printStackTrace();
+ }
+ ClientVerifyAndLockNameResponse response = new ClientVerifyAndLockNameResponse(firstName, approved_flag);
+ session.write(response.serialize());
+ }
+
+
+ });
+
+ swgOpcodes.put(Opcodes.ClientCreateCharacter, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+
+ data = data.order(ByteOrder.LITTLE_ENDIAN);
+ data.position(0);
+ ClientCreateCharacter clientCreateCharacter = new ClientCreateCharacter();
+ clientCreateCharacter.deserialize(data);
+
+ engine.resources.config.Config config = new engine.resources.config.Config();
+ config.setFilePath("nge.cfg");
+ if (!(config.loadConfigFile())) {
+ config = engine.resources.config.DefaultConfig.getConfig();
+ }
+
+ int galaxyId = config.getInt("GALAXY_ID");
+
+ // FIXME: this is just a hack for issue where something goes tits up
+ // between verify and create and client resends
+ /*try {
+ //if (checkForDuplicateName(getfirstName(clientCreateCharacter.getName(), clientCreateCharacter.getRaceTemplate()))) return;
+ }
+ catch (SQLException e2) {
+ e2.printStackTrace();
+ }*/
+ Client client = core.getClient((Integer) session.getAttribute("connectionId"));
+
+ // TODO: Add starting location and items in a script
+ String raceTemplate = clientCreateCharacter.getRaceTemplate();
+ // should set to some planet and starting location
+ String sharedRaceTemplate = raceTemplate.replace("player/", "player/shared_");
+
+ CreatureObject object = (CreatureObject) core.objectService.createObject(sharedRaceTemplate, core.terrainService.getPlanetList().get(0));
+ object.setCustomizationData(clientCreateCharacter.getCustomizationData());
+ object.setCustomName(clientCreateCharacter.getName());
+ object.setHeight(clientCreateCharacter.getScale());
+ object.setPersistent(true);
+ object.setPosition(new Point3D(3608, 5, -4753));
+ //object.setPosition(new Point3D(0, 0, 0));
+ object.setOrientation(new Quaternion(1, 0, 1, 0));
+ object.createTransaction(core.getCreatureODB().getEnvironment());
+
+ PlayerObject player = (PlayerObject) core.objectService.createObject("object/player/shared_player.iff", object.getPlanet());
+ object.add(player);
+ player.setProfession(clientCreateCharacter.getProfession());
+ player.setProfessionWheelPosition(clientCreateCharacter.getProfessionWheelPosition());
+ if(clientCreateCharacter.getHairObject().length() > 0) {
+ String sharedHairTemplate = clientCreateCharacter.getHairObject().replace("/hair_", "/shared_hair_");
+ TangibleObject hair = (TangibleObject) core.objectService.createObject(sharedHairTemplate, object.getPlanet());
+ if(clientCreateCharacter.getHairCustomization().length > 0)
+ hair.setCustomization(clientCreateCharacter.getHairCustomization());
+ object.add(hair);
+ }
+
+ TangibleObject inventory = (TangibleObject) core.objectService.createObject("object/tangible/inventory/shared_character_inventory.iff", object.getPlanet());
+ TangibleObject appInventory = (TangibleObject) core.objectService.createObject("object/tangible/inventory/shared_appearance_inventory.iff", object.getPlanet());
+ TangibleObject datapad = (TangibleObject) core.objectService.createObject("object/tangible/datapad/shared_character_datapad.iff", object.getPlanet());
+ TangibleObject bank = (TangibleObject) core.objectService.createObject("object/tangible/bank/shared_character_bank.iff", object.getPlanet());
+ TangibleObject missionBag = (TangibleObject) core.objectService.createObject("object/tangible/mission_bag/shared_mission_bag.iff", object.getPlanet());
+ object.add(inventory);
+ object.add(appInventory);
+ object.add(datapad);
+ object.add(bank);
+ object.add(missionBag);
+ TangibleObject backpack = (TangibleObject) core.objectService.createObject("object/tangible/wearables/backpack/shared_backpack_galactic_marine.iff", object.getPlanet());
+ inventory.add(backpack);
+ object.addObjectToEquipList(datapad);
+ object.addObjectToEquipList(inventory);
+ WeaponObject weapon = (WeaponObject) core.objectService.createObject("object/weapon/ranged/rifle/shared_rifle_a280.iff", object.getPlanet());
+ WeaponObject defaultWeapon = (WeaponObject) core.objectService.createObject("object/weapon/creature/shared_creature_default_weapon.iff", object.getPlanet());
+
+ object.addObjectToEquipList(defaultWeapon);
+
+ object.add(defaultWeapon);
+
+ object.addObjectToEquipList(weapon);
+
+ object.add(weapon);
+ object.setWeaponId(weapon.getObjectID());
+
+ core.scriptService.callScript("scripts/", "demo", "CreateStartingCharacter", object);
+
+
+
+ core.getCreatureODB().put(object, Long.class, CreatureObject.class, object.getTransaction());
+ // might not need to commit transaction but better safe than sorry
+ object.getTransaction().commit();
+
+ PreparedStatement ps = databaseConnection.preparedStatement("INSERT INTO characters (id, \"firstName\", \"lastName\", \"accountId\", \"galaxyId\", \"statusId\", appearance, gmflag) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
+ ps.setLong(1, object.getObjectID());
+ ps.setString(2, clientCreateCharacter.getFirstName());
+ ps.setString(3, clientCreateCharacter.getLastName());
+ ps.setInt(4, (int) client.getAccountId()); // accountID
+ ps.setInt(5, galaxyId);
+ ps.setInt(6, 1);
+ ps.setInt(7, CRC.StringtoCRC(raceTemplate));
+ ps.setBoolean(8, false);
+ ps.executeUpdate();
+ ps.close();
+ CreateCharacterSuccess success = new CreateCharacterSuccess(object.getObjectID());
+
+ session.write(core.loginService.getLoginCluster().serialize());
+ session.write(core.loginService.getLoginClusterStatus().serialize());
+
+ session.write(success.serialize());
+
+ }
+
+ });
+
+ }
+
+ private boolean checkForDuplicateName(String firstName) throws SQLException
+ {
+ firstName = firstName.replace("'", "''");
+ firstName = firstName.toLowerCase();
+ PreparedStatement ps = databaseConnection.preparedStatement("SELECT id FROM characters WHERE LOWER(\"firstName\") ='" + firstName + "'");
+ ResultSet resultSet = ps.executeQuery();
+
+ boolean bool = resultSet.next();
+ resultSet.getStatement().close();
+ return bool;
+ }
+
+
+ private String getfirstName(String Name, String RaceTemplate)
+ {
+ String[] splitName;
+ if (RaceTemplate != "object/creature/player/wookiee_male.iff" | RaceTemplate != "object/creature/player/wookiee_female.iff")
+ { // wookies don't have lastNames
+ if (Name.contains(" "))
+ {
+ splitName = Name.split(" ", 2);
+ return splitName[0];
+ }
+ else
+ {
+ return Name;
+ }
+ }
+ else
+ {
+ return Name;
+ }
+ }
+
+ private String getlastName(String Name, String RaceTemplate)
+ {
+ String[] splitName;
+ if (RaceTemplate != "object/creature/player/wookiee_male.iff" && RaceTemplate != "object/creature/player/wookiee_female.iff")
+ { // wookies don't have lastNames
+ if (Name.contains(" "))
+ {
+ splitName = Name.split(" ", 2);
+ return splitName[1];
+ }
+ else
+ {
+ return "";
+ }
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ private String checkForReservedName(String firstName, String lastName) throws SQLException
+ {
+ firstName = firstName.toLowerCase();
+ lastName = lastName.toLowerCase();
+
+ firstName.replaceAll("'", "");
+ firstName.replaceAll("-", "");
+ lastName.replaceAll("'", "");
+ lastName.replaceAll("-", "");
+
+ String combinedName = firstName + " " + lastName;
+ combinedName.replaceAll("\\s*$", "");
+
+ String query = "SELECT \"type\" FROM \"reservednames\" WHERE (\"match_firstname\" = TRUE AND ? ~ \"pattern\") OR (\"match_both_names\" = TRUE and ? ~ \"pattern\") ";
+ if (lastName != "")
+ {
+ query = query + " OR (\"match_lastname\" = TRUE and ? ~ \"pattern\") ";
+ }
+
+ PreparedStatement ps = databaseConnection.preparedStatement(query);
+ ps.setString(1, firstName);
+ ps.setString(2, combinedName);
+ if (lastName != "")
+ {
+ ps.setString(3, lastName);
+ }
+
+ ResultSet resultSet = ps.executeQuery();
+
+ if (resultSet.next())
+ {
+
+ return resultSet.getString("type");
+
+ }
+
+ return null;
+ }
+
+
+ @Override
+ public void shutdown() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/services/ConnectionService.java b/src/services/ConnectionService.java
new file mode 100644
index 00000000..3bc7510f
--- /dev/null
+++ b/src/services/ConnectionService.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services;
+
+import java.nio.ByteOrder;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Map;
+import java.util.concurrent.ScheduledExecutorService;
+
+import main.NGECore;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IoSession;
+
+import protocol.swg.AccountFeatureBits;
+import protocol.swg.ClientIdMsg;
+import protocol.swg.ClientPermissionsMessage;
+import protocol.swg.ConnectionServerLagResponse;
+import protocol.swg.GalaxyLoopTimesResponse;
+import protocol.swg.GameServerLagResponse;
+import protocol.swg.LoginClientId;
+
+import engine.clients.Client;
+import engine.resources.common.Utilities;
+import engine.resources.database.DatabaseConnection;
+import engine.resources.service.INetworkDispatch;
+import engine.resources.service.INetworkRemoteEvent;
+import resources.common.*;
+
+
+
+public class ConnectionService implements INetworkDispatch {
+
+ private NGECore core;
+ private DatabaseConnection databaseConnection;
+ @SuppressWarnings("unused")
+ private DatabaseConnection databaseConnection2;
+
+ public ConnectionService(NGECore core) {
+
+ this.core = core;
+ this.databaseConnection = core.getDatabase1();
+ this.databaseConnection2 = core.getDatabase2();
+
+ }
+
+ @Override
+ public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) {
+
+ swgOpcodes.put(Opcodes.ClientIdMsg, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+ data = data.order(ByteOrder.LITTLE_ENDIAN);
+ ClientIdMsg clientIdMsg = new ClientIdMsg();
+ data.position(0);
+ clientIdMsg.deserialize(data);
+
+ Client client = core.getClient((Integer) session.getAttribute("connectionId"));
+ if(client == null) System.out.println("NULL Client");
+ client.setSession(session);
+ ResultSet resultSet;
+ PreparedStatement preparedStatement;
+ System.out.println(clientIdMsg.getSessionKey().length);
+
+ try {
+
+ preparedStatement = databaseConnection.preparedStatement("SELECT * FROM sessions WHERE key=?");
+ preparedStatement.setBytes(1, clientIdMsg.getSessionKey());
+ resultSet = preparedStatement.executeQuery();
+
+ if (resultSet.next()) {
+ client.setAccountId(resultSet.getInt("accountId"));
+ AccountFeatureBits accountFeatureBits = new AccountFeatureBits();
+ ClientPermissionsMessage clientPermissionsMessage = new ClientPermissionsMessage();
+ session.write(accountFeatureBits.serialize());
+ session.write(clientPermissionsMessage.serialize());
+ preparedStatement.close();
+
+ }
+
+ } catch (SQLException e) {
+
+ e.printStackTrace();
+
+ }
+
+ }
+
+
+
+ });
+
+ swgOpcodes.put(Opcodes.RequestGalaxyLoopTimes, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+
+ GalaxyLoopTimesResponse response = new GalaxyLoopTimesResponse(0);
+ session.write(response.serialize());
+
+ }
+
+ });
+
+ swgOpcodes.put(Opcodes.LagRequest, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+
+ ConnectionServerLagResponse connectionReponse = new ConnectionServerLagResponse();
+ session.write(connectionReponse.serialize());
+ GameServerLagResponse gameReponse = new GameServerLagResponse();
+ session.write(gameReponse.serialize());
+
+ }
+
+ });
+
+
+ }
+
+ @Override
+ public void shutdown() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/services/LoginService.java b/src/services/LoginService.java
new file mode 100644
index 00000000..3fb09283
--- /dev/null
+++ b/src/services/LoginService.java
@@ -0,0 +1,462 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services;
+
+import java.nio.ByteOrder;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.ScheduledExecutorService;
+
+import main.NGECore;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IoSession;
+
+import engine.clients.Client;
+import engine.protocol.soe.Disconnect;
+import engine.resources.common.PHPBB3Auth;
+import engine.resources.common.Utilities;
+import engine.resources.database.DatabaseConnection;
+import engine.resources.service.INetworkDispatch;
+import engine.resources.service.INetworkRemoteEvent;
+
+import protocol.swg.CharacterCreationDisabled;
+import protocol.swg.ClientUIErrorMessage;
+import protocol.swg.DeleteCharacterMessage;
+import protocol.swg.DeleteCharacterReplyMessage;
+import protocol.swg.EnumerateCharacterId;
+import protocol.swg.LoginClientId;
+import protocol.swg.LoginClientToken;
+import protocol.swg.LoginClusterStatus;
+import protocol.swg.LoginEnumCluster;
+import protocol.swg.ServerNowEpochTime;
+import protocol.swg.StationIdHasJediSlot;
+import resources.common.*;
+
+import resources.objects.creature.CreatureObject;
+
+public class LoginService implements INetworkDispatch{
+
+ private int sessionKeyLength = 0;
+ private NGECore core;
+ private DatabaseConnection databaseConnection;
+ private DatabaseConnection databaseConnection2;
+ private Random random;
+
+ public LoginService(NGECore core) {
+ this.core = core;
+ this.sessionKeyLength = core.getConfig().getInt("LOGIN.SESSION_KEY_SIZE");
+ this.databaseConnection = core.getDatabase1();
+ this.databaseConnection2 = core.getDatabase2();
+ this.random = new Random();
+ }
+
+ public void insertTimedEventBindings(ScheduledExecutorService executor) {
+
+ }
+
+
+ public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) {
+
+ swgOpcodes.put(Opcodes.LoginClientId, new INetworkRemoteEvent() {
+
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+
+ data = data.order(ByteOrder.LITTLE_ENDIAN);
+ LoginClientId clientID = new LoginClientId();
+ data.position(0);
+ clientID.deserialize(data);
+
+ String err = "";
+ String user = clientID.getAccountName();
+ String pass = clientID.getPassword();
+ int id = getAccountID(user);
+ if (id == -1) err = "Invalid Username";
+ //String email = getAccountEmail(user);
+ //String encryptPass = getAccountPassword(user);
+
+ if (err == "")
+ err = canUserLogin(user, /*email*/"", pass, /*encryptPass*/"", id, session.getRemoteAddress().toString());
+
+ if (err != "") {
+ System.out.println(user + " failed login because " + err);
+ ClientUIErrorMessage errMsg = new ClientUIErrorMessage("Invalid Login", err);
+ session.write(errMsg.serialize());
+ Disconnect disconnect = new Disconnect((Integer)session.getAttribute("connectionId"), 6);
+ session.write(disconnect);
+ session.close(false);
+ return;
+ }
+
+ System.out.println(user + " successfully logged in.");
+
+ Client client = new Client(session.getRemoteAddress());
+ client.setAccountName(user);
+ client.setPassword(pass);
+ client.setSessionKey(generateSessionKey());
+ client.setAccountId(id);
+ //client.setAccountEmail(email);
+ client.setSession(session);
+
+ core.addClient((Integer)session.getAttribute("connectionId"), client);
+
+ /*if(!checkIfAccountExistInGameDB(id)) {
+ createAccountForGameDB(id, user, email, encryptPass);
+ }*/
+
+ persistSession(client);
+
+ LoginEnumCluster servers = getLoginCluster();
+ LoginClusterStatus serverStatus = getLoginClusterStatus();
+ EnumerateCharacterId characters = getEnumerateCharacterId(id);
+
+ LoginClientToken clientToken = new LoginClientToken(client.getSessionKey(), id, user);
+ CharacterCreationDisabled charCreationDisabled = new CharacterCreationDisabled(0);
+ StationIdHasJediSlot jediSlot = new StationIdHasJediSlot(false);
+ ServerNowEpochTime time = new ServerNowEpochTime(0);
+
+ session.write(time.serialize());
+ session.write(clientToken.serialize());
+ session.write(servers.serialize());
+ session.write(charCreationDisabled.serialize());
+ session.write(serverStatus.serialize());
+ session.write(jediSlot.serialize());
+ session.write(characters.serialize());
+ }
+
+ });
+
+ swgOpcodes.put(Opcodes.DeleteCharacterMessage, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+
+ data = data.order(ByteOrder.LITTLE_ENDIAN);
+ data.position(0);
+
+ DeleteCharacterMessage packet = new DeleteCharacterMessage();
+ packet.deserialize(data);
+ Client client = core.getClient((Integer) session.getAttribute("connectionId"));
+
+ PreparedStatement preparedStatement;
+
+ preparedStatement = databaseConnection.preparedStatement("DELETE FROM characters WHERE \"id\"=? AND \"galaxyId\"=? AND \"accountId\"=?");
+ preparedStatement.setLong(1, packet.getcharId());
+ preparedStatement.setInt(2, packet.getgalaxyId());
+ preparedStatement.setInt(3, (int) client.getAccountId());
+ boolean resultSet = preparedStatement.execute();
+ //TODO: send deletecharacter failed
+ if(!resultSet) {
+ core.getCreatureODB().delete(new Long(packet.getcharId()), Long.class, CreatureObject.class);
+ DeleteCharacterReplyMessage reply = new DeleteCharacterReplyMessage(0);
+ session.write(reply.serialize());
+ }
+ preparedStatement.close();
+
+ }
+
+ });
+
+ }
+
+
+ public void shutdown() {
+
+ }
+ /**
+ * Saves session data to DB so Zone Server can link sessions to accounts.
+ * @param client Client that needs a session save.
+ */
+ private void persistSession(Client client) throws SQLException {
+
+ String sessionValues = "?, " + client.getAccountId();
+ PreparedStatement ps = databaseConnection.preparedStatement("INSERT INTO sessions (key, \"accountId\") VALUES (" + sessionValues + ")");
+ ps.setBytes(1, client.getSessionKey());
+ ps.executeUpdate();
+ ps.close();
+
+ }
+
+ /**
+ * Generates random Session Key.
+ * @return random Session Key.
+ */
+ private byte [] generateSessionKey() {
+ byte [] bytes = new byte[sessionKeyLength];
+ random.nextBytes(bytes);
+ return bytes;
+ }
+
+ /**
+ * Generates EnumerateCharacterId packet.
+ * @param id Account ID of client.
+ * @return EnumerateCharacterId packet.
+ */
+ private EnumerateCharacterId getEnumerateCharacterId(int id) {
+
+ ResultSet resultSet;
+ EnumerateCharacterId enumerateCharacterId = new EnumerateCharacterId();
+ PreparedStatement preparedStatement;
+
+ try {
+ preparedStatement = databaseConnection.preparedStatement("SELECT * FROM characters WHERE \"accountId\"=" + id + "");
+ resultSet = preparedStatement.executeQuery();
+
+ while (resultSet.next() && !resultSet.isClosed()) {
+
+ String characterName = resultSet.getString("firstName").replaceAll("\\s",""); ;
+ String lastName = resultSet.getString("lastName").replaceAll("\\s","");
+ if (lastName != null && lastName.length() > 0) characterName += " " + lastName;
+ enumerateCharacterId.addCharacter(
+ characterName,
+ resultSet.getInt("appearance"),
+ resultSet.getLong("Id"),
+ resultSet.getInt("galaxyId"),
+ resultSet.getInt("statusId"));
+ }
+ resultSet.close();
+ preparedStatement.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return enumerateCharacterId;
+ }
+
+ /**
+ * Generates LoginEnumCluster packet.
+ * @return LoginEnumCluster packet.
+ */
+ public LoginEnumCluster getLoginCluster() {
+ LoginEnumCluster servers = new LoginEnumCluster(9);
+ PreparedStatement preparedStatement;
+ try {
+ preparedStatement = databaseConnection.preparedStatement("SELECT * FROM galaxies");
+ ResultSet resultSet = preparedStatement.executeQuery();
+ while (resultSet.next() && !resultSet.isClosed())
+ servers.addServer(resultSet.getInt("id"), resultSet.getString("name"));
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ return servers;
+ }
+
+ /**
+ * Generates LoginClusterStatus packet.
+ * @return LoginClusterStatus packet.
+ */
+ public LoginClusterStatus getLoginClusterStatus() {
+ LoginClusterStatus clusterStatus = new LoginClusterStatus();
+ ResultSet resultSet;
+ try {
+ PreparedStatement preparedStatement = databaseConnection.preparedStatement("SELECT * FROM \"connectionServers\"");
+ resultSet = preparedStatement.executeQuery();
+ while (resultSet.next() && !resultSet.isClosed())
+ clusterStatus.addServer(
+ resultSet.getInt("id"),
+ resultSet.getString("address"),
+ resultSet.getInt("port"),
+ resultSet.getInt("pingPort"),
+ 100,
+ resultSet.getInt("statusId"),
+ 1,
+ core.getActiveClients());
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return clusterStatus;
+ }
+
+ /**
+ * Checks if account ID exists in game DB.
+ * @param id Account ID.
+ */
+ private boolean checkIfAccountExistInGameDB(int id) {
+ try {
+ PreparedStatement preparedStatement = databaseConnection.preparedStatement("SELECT * FROM accounts WHERE id=?");
+ preparedStatement.setInt(1, id);
+ ResultSet resultSet = preparedStatement.executeQuery();
+ if (resultSet.next()) {
+ return true;
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+ /**
+ * Saves forum account to game DB if the account does not exist in the game DB already.
+ * @param id Account ID.
+ * @param user Username
+ * @param email User's email
+ * @param pass Hashed password
+ */
+ private void createAccountForGameDB(int id, String user, String email, String pass) {
+ try {
+ PreparedStatement ps = databaseConnection.preparedStatement("INSERT INTO accounts (id, \"user\", \"pass\", \"email\") VALUES (?, ?, ?, ?)");
+ ps.setInt(1, id);
+ ps.setString(2, user);
+ ps.setString(3, pass);
+ ps.setString(4, email);
+ ps.executeUpdate();
+ ps.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ /**
+ * Checks if user is allowed to login.
+ * @param id Account ID.
+ * @param user Username
+ * @param email User's email
+ * @param pass User password
+ * @param encryptPass encrypted password
+ * @param ip Users IP address
+ */
+ private String canUserLogin(String user, String email, String pass, String encryptPass, int id, String ip) {
+ /*if ((new PHPBB3Auth()).phpbb_check_hash(pass, encryptPass)) {
+ if(checkBanlistforUserAndIP(id, ip)) {
+ return "You cannot login to the ProjectSWG server while being banned from ProjectSWG services";
+ }
+ return "";
+ } else {
+ return "Invalid Password";
+ }*/
+
+ try {
+ PreparedStatement ps = databaseConnection.preparedStatement("SELECT * FROM accounts WHERE id=" + id + " AND \"pass\"='" + pass + "'");
+ ResultSet resultSet = ps.executeQuery();
+
+ if (resultSet.next()) {
+
+ return "";
+
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ return "Invalid Password";
+
+
+ }
+ /**
+ * Checks if User has a forum account or IP ban.
+ * @param id Account ID.
+ * @param ip User's IP address.
+ */
+ private boolean checkBanlistforUserAndIP(int id, String ip) {
+ if (!ip.contains("/"))
+ return false;
+ String IP = ((ip.split("/", 2)[1]).split(", ", 2)[0]).split(":", 2)[0];
+ try {
+ PreparedStatement preparedStatement = databaseConnection2.preparedStatement("SELECT ban_id FROM phpbb_banlist WHERE ban_ip=?");
+ preparedStatement.setString(1, IP);
+ ResultSet resultSet = preparedStatement.executeQuery();
+ if (resultSet.next()) {
+ return true;
+ } else {
+ preparedStatement.close();
+ preparedStatement = databaseConnection2.preparedStatement("SELECT ban_id FROM phpbb_banlist WHERE ban_userid=?");
+ preparedStatement.setInt(1, id);
+ resultSet = preparedStatement.executeQuery();
+ if (resultSet.next()) {
+ return true;
+ }
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+
+ @SuppressWarnings("unused")
+ /**
+ * Checks if User has correct client version.
+ * @param version Client Version String
+ */
+ private boolean checkVersion(String version) {
+ System.out.println("Version Received: " + version);
+ return true;
+ }
+
+ /**
+ * Gets Account ID from forum DB by username.
+ * @param user Username.
+ */
+ private int getAccountID(String user) {
+ try {
+ PreparedStatement pStatement = databaseConnection.preparedStatement("SELECT id FROM accounts WHERE \"user\"='" + user + "'");
+ ResultSet resultSet = pStatement.executeQuery();
+ if (resultSet.next()) {
+ return resultSet.getInt("id");
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ };
+ return -1;
+ }
+
+ /**
+ * Gets Account Email from forum DB by username.
+ * @param user Username.
+ */
+ private String getAccountEmail(String user) {
+ try {
+ PreparedStatement pStatement = databaseConnection2.preparedStatement("SELECT user_email FROM phpbb_users WHERE username=?");
+ pStatement.setString(1, user);
+ ResultSet resultSet = pStatement.executeQuery();
+
+ if (resultSet.next()) {
+ return resultSet.getString("user_email");
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ };
+ return "";
+ }
+
+ /**
+ * Gets hashed Account Password from forum DB by username.
+ * @param user Username.
+ */
+ private String getAccountPassword(String user) {
+ try {
+ PreparedStatement pStatement = databaseConnection2.preparedStatement("SELECT user_password FROM phpbb_users WHERE username=?");
+ pStatement.setString(1, user);
+ ResultSet resultSet = pStatement.executeQuery();
+
+ if (resultSet.next()) {
+ return resultSet.getString("user_password");
+ }
+ pStatement.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ };
+ return "";
+ }
+
+}
diff --git a/src/services/MapService.java b/src/services/MapService.java
new file mode 100644
index 00000000..cb1ae4e5
--- /dev/null
+++ b/src/services/MapService.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledExecutorService;
+
+import engine.resources.objects.SWGObject;
+import engine.resources.scene.Grid2D;
+import engine.resources.scene.Planet;
+import engine.resources.service.INetworkDispatch;
+import engine.resources.service.INetworkRemoteEvent;
+
+import main.NGECore;
+
+
+@SuppressWarnings("unused")
+
+public class MapService implements INetworkDispatch {
+
+ private NGECore core;
+
+
+ public MapService(NGECore core) {
+ this.core = core;
+ }
+
+ public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) {
+
+ }
+
+ public void shutdown() {
+
+ }
+
+}
diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java
new file mode 100644
index 00000000..aab2dfd4
--- /dev/null
+++ b/src/services/PlayerService.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services;
+
+public class PlayerService {
+
+}
diff --git a/src/services/SUIService.java b/src/services/SUIService.java
new file mode 100644
index 00000000..feed4983
--- /dev/null
+++ b/src/services/SUIService.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services;
+
+public class SUIService {
+
+}
diff --git a/src/services/ScriptService.java b/src/services/ScriptService.java
new file mode 100644
index 00000000..a70fd9ee
--- /dev/null
+++ b/src/services/ScriptService.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services;
+
+import org.python.core.Py;
+import org.python.core.PyCode;
+import org.python.core.PyObject;
+import org.python.core.PySystemState;
+import org.python.util.PythonInterpreter;
+
+import main.NGECore;
+
+public class ScriptService {
+
+ private NGECore core;
+ private PythonInterpreter interpreter;
+
+ public ScriptService(NGECore core) {
+ this.core = core;
+ }
+
+ public void callScript(String path, String module, String method) {
+ PythonInterpreter interpreter = new PythonInterpreter();
+ interpreter.exec("import sys\nsys.path.append('" + path + "')\nfrom " + module + " import " + method);
+ PyObject func = interpreter.get(method);
+ func.__call__(Py.java2py(core));
+ interpreter.cleanup();
+ }
+
+ public void callScript(String path, String module, String method, Object arg1) {
+ PythonInterpreter interpreter = new PythonInterpreter();
+ interpreter.exec("import sys\nsys.path.append('" + path + "')\nfrom " + module + " import " + method);
+ PyObject func = interpreter.get(method);
+ func.__call__(Py.java2py(core), Py.java2py(arg1));
+ interpreter.cleanup();
+ }
+
+ public void callScript(String path, String method, String module, Object arg1, Object arg2) {
+ PythonInterpreter interpreter = new PythonInterpreter();
+ interpreter.exec("import sys\nsys.path.append('" + path + "')\nfrom " + module + " import " + method);
+ PyObject func = interpreter.get(method);
+ func.__call__(Py.java2py(arg1), Py.java2py(arg2));
+ interpreter.cleanup();
+ }
+
+ public void callScript(String path, String method, String module, Object arg1, Object arg2, Object arg3) {
+ PythonInterpreter interpreter = new PythonInterpreter();
+ interpreter.exec("import sys\nsys.path.append('" + path + "')\nfrom " + module + " import " + method);
+ PyObject func = interpreter.get(method);
+ func.__call__(Py.java2py(arg1), Py.java2py(arg2), Py.java2py(arg3));
+ interpreter.cleanup();
+ }
+
+ public void callScript(String path, String module, String method, Object arg1, Object arg2, Object arg3, Object arg4) {
+ PythonInterpreter interpreter = new PythonInterpreter();
+ interpreter.exec("import sys\nsys.path.append('" + path + "')\nfrom " + module + " import " + method);
+ PyObject func = interpreter.get(method);
+ func.__call__(Py.java2py(arg1), Py.java2py(arg2), Py.java2py(arg3), Py.java2py(arg4));
+ interpreter.cleanup();
+ }
+
+
+}
diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java
new file mode 100644
index 00000000..0c298bd6
--- /dev/null
+++ b/src/services/SimulationService.java
@@ -0,0 +1,677 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services;
+
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledExecutorService;
+
+import main.NGECore;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math3.linear.MatrixUtils;
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IoSession;
+
+import com.vividsolutions.jts.math.Matrix;
+
+
+import engine.clientdata.ClientFileManager;
+import engine.clientdata.visitors.MeshVisitor;
+import engine.clientdata.visitors.PortalVisitor;
+import engine.clientdata.visitors.PortalVisitor.Cell;
+import engine.clients.Client;
+import engine.resources.objects.SWGObject;
+import engine.resources.scene.Grid2D;
+import engine.resources.scene.Planet;
+import engine.resources.scene.Point3D;
+import engine.resources.scene.Quaternion;
+import engine.resources.scene.quadtree.QuadTree;
+import engine.resources.service.INetworkDispatch;
+import engine.resources.service.INetworkRemoteEvent;
+
+import protocol.swg.ClientIdMsg;
+import protocol.swg.ObjControllerMessage;
+import protocol.swg.OpenedContainerMessage;
+import protocol.swg.UpdateTransformMessage;
+import protocol.swg.UpdateTransformWithParentMessage;
+import protocol.swg.objectControllerObjects.DataTransform;
+import protocol.swg.objectControllerObjects.DataTransformWithParent;
+import protocol.swg.objectControllerObjects.TargetUpdate;
+
+import resources.objects.cell.CellObject;
+import resources.objects.creature.CreatureObject;
+import resources.common.*;
+import toxi.geom.Matrix4x4;
+import wblut.geom.WB_AABBNode;
+import wblut.geom.WB_AABBTree;
+import wblut.geom.WB_Intersection;
+import wblut.geom.WB_Point3d;
+import wblut.geom.WB_Ray;
+import wblut.geom.WB_Transform;
+import wblut.geom.WB_Vector3d;
+import wblut.hemesh.HE_Mesh;
+import wblut.math.WB_M44;
+
+public class SimulationService implements INetworkDispatch {
+
+ Map> quadTrees;
+ private NGECore core;
+
+ public SimulationService(NGECore core) {
+ this.core = core;
+ TerrainService terrainService = core.terrainService;
+ quadTrees = new ConcurrentHashMap>();
+
+ for (int i = 0; i < core.terrainService.getPlanetList().size(); i++) {
+ quadTrees.put(terrainService.getPlanetList().get(i).getName(), new QuadTree(-8192, -8192, 8192, 8192));
+ }
+
+ List objectList = core.objectService.getObjectList();
+
+ for(SWGObject obj : objectList) {
+ if(obj.getParentId() == 0) {
+ add(obj, obj.getPosition().x, obj.getPosition().z);
+ }
+ }
+
+ core.commandService.registerCommand("opencontainer");
+ core.commandService.registerCommand("transferitem");
+ core.commandService.registerCommand("transferitemarmor");
+ core.commandService.registerCommand("transferitemweapon");
+ core.commandService.registerCommand("transferitemmisc");
+ core.commandService.registerCommand("equip");
+ core.commandService.registerCommand("prone");
+ core.commandService.registerCommand("stand");
+ core.commandService.registerCommand("sitserver");
+ core.commandService.registerCommand("kneel");
+ core.commandService.registerCommand("serverdestroyobject");
+ core.commandService.registerCommand("giveitem");
+ core.commandService.registerCommand("object");
+
+ }
+
+ public void add(SWGObject object, int x, int y) {
+ object.setIsInQuadtree(true);
+ quadTrees.get(object.getPlanet().getName()).put(x, y, object);
+ }
+
+ public void add(SWGObject object, float x, float y) {
+ object.setIsInQuadtree(true);
+ quadTrees.get(object.getPlanet().getName()).put(x, y, object);
+ }
+
+ public boolean move(SWGObject object, int oldX, int oldY, int newX, int newY) {
+ if(quadTrees.get(object.getPlanet().getName()).remove(oldX, oldY, object)) {
+ return quadTrees.get(object.getPlanet().getName()).put(newX, newY, object);
+ }
+
+ return false;
+ }
+
+ public boolean move(SWGObject object, float oldX, float oldY, float newX, float newY) {
+ long startTime = System.nanoTime();
+ if(quadTrees.get(object.getPlanet().getName()).remove(oldX, oldY, object)) {
+ boolean success = quadTrees.get(object.getPlanet().getName()).put(newX, newY, object);
+ return success;
+ }
+ System.out.println("Move failed.");
+ return false;
+ }
+
+ public List get(Planet planet, int x, int y, int range) {
+ return quadTrees.get(planet.getName()).get(x, y, range);
+ }
+
+ public List get(Planet planet, float x, float y, int range) {
+ List list = quadTrees.get(planet.getName()).get((int)x, (int)y, range);
+ return list;
+ }
+
+ public boolean remove(SWGObject object, int x, int y) {
+ return quadTrees.get(object.getPlanet().getName()).remove(x, y, object);
+ }
+
+ public boolean remove(SWGObject object, float x, float y) {
+ boolean success = quadTrees.get(object.getPlanet().getName()).remove(x, y, object);
+ return success;
+ }
+
+ @Override
+ public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) {
+
+ objControllerOpcodes.put(ObjControllerOpcodes.DATA_TRANSFORM, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+
+ data.order(ByteOrder.LITTLE_ENDIAN);
+
+ DataTransform dataTransform = new DataTransform();
+ dataTransform.deserialize(data);
+ //System.out.println("Movement Counter: " + dataTransform.getMovementCounter());
+ Client client = core.getClient((Integer) session.getAttribute("connectionId"));
+
+ if(client == null) {
+ System.out.println("NULL Client");
+ return;
+ }
+
+ if(client.getParent() == null) {
+ System.out.println("NULL Object");
+ return;
+ }
+
+ CreatureObject object = (CreatureObject) client.getParent();
+ Point3D newPos;
+ Point3D oldPos;
+ synchronized(object.getMutex()) {
+ newPos = new Point3D(dataTransform.getXPosition(), dataTransform.getYPosition(), dataTransform.getZPosition());
+ oldPos = object.getPosition();
+ //Collection oldObservers = object.getObservers();
+ //Collection newObservers = new HashSet();
+ if(object.getContainer() == null)
+ move(object, oldPos.x, oldPos.z, newPos.x, newPos.z);
+ Quaternion newOrientation = new Quaternion(dataTransform.getWOrientation(), dataTransform.getXOrientation(), dataTransform.getYOrientation(), dataTransform.getZOrientation());
+ object.setPosition(newPos);
+ object.setOrientation(newOrientation);
+ object.setMovementCounter(dataTransform.getMovementCounter());
+ }
+ if(object.getContainer() != null) {
+ object.getContainer()._remove(object);
+ add(object, newPos.x, newPos.z);
+ }
+
+
+
+
+ //object.setParentId(0);
+ //object.setParent(null);
+ // System.out.println("Parsed Height: " + core.terrainService.getHeight(object.getPlanetId(), dataTransform.getXPosition(), dataTransform.getZPosition())
+ // + " should be: " + dataTransform.getYPosition());
+ UpdateTransformMessage utm = new UpdateTransformMessage(object.getObjectID(), dataTransform.getTransformedX(), dataTransform.getTransformedY(), dataTransform.getTransformedZ(), dataTransform.getMovementCounter(), (byte) dataTransform.getMovementAngle(), dataTransform.getSpeed(), object.getCombatFlag());
+
+ List newAwareObjects = get(object.getPlanet(), newPos.x, newPos.z, 200);
+ ArrayList oldAwareObjects = new ArrayList(object.getAwareObjects());
+ Collection updateAwareObjects = CollectionUtils.intersection(oldAwareObjects, newAwareObjects);
+ object.notifyObservers(utm, false);
+
+ for(int i = 0; i < oldAwareObjects.size(); i++) {
+ SWGObject obj = oldAwareObjects.get(i);
+ if(!updateAwareObjects.contains(obj) && obj != object && obj.getWorldPosition().getDistance2D(newPos) > 200 && obj.isInQuadtree() /*&& obj.getParentId() == 0*/) {
+ object.makeUnaware(obj);
+ if(obj.getClient() != null)
+ obj.makeUnaware(object);
+ }
+ }
+ for(int i = 0; i < newAwareObjects.size(); i++) {
+ SWGObject obj = newAwareObjects.get(i);
+ if(!updateAwareObjects.contains(obj) && obj != object && !object.getAwareObjects().contains(obj) && obj.getWorldPosition().getDistance2D(newPos) <= 200 && obj.getContainer() != object && obj.isInQuadtree()) {
+ object.makeAware(obj);
+ if(obj.getClient() != null)
+ obj.makeAware(object);
+ }
+ }
+
+
+
+ }
+
+
+ });
+
+ objControllerOpcodes.put(ObjControllerOpcodes.DATA_TRANSFORM_WITH_PARENT, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+
+ data.order(ByteOrder.LITTLE_ENDIAN);
+
+ DataTransformWithParent dataTransform = new DataTransformWithParent();
+ dataTransform.deserialize(data);
+ //System.out.println("Movement Counter: " + dataTransform.getMovementCounter());
+ Client client = core.getClient((Integer) session.getAttribute("connectionId"));
+
+ if(core.objectService.getObject(dataTransform.getCellId()) == null)
+ return;
+
+ SWGObject parent = core.objectService.getObject(dataTransform.getCellId());
+
+ if(client == null) {
+ System.out.println("NULL Client");
+ return;
+ }
+
+ if(client.getParent() == null) {
+ System.out.println("NULL Object");
+ return;
+ }
+ CreatureObject object = (CreatureObject) client.getParent();
+
+ Point3D newPos = new Point3D(dataTransform.getXPosition(), dataTransform.getYPosition(), dataTransform.getZPosition());
+ Point3D oldPos = object.getPosition();
+ Quaternion newOrientation = new Quaternion(dataTransform.getWOrientation(), dataTransform.getXOrientation(), dataTransform.getYOrientation(), dataTransform.getZOrientation());
+
+ UpdateTransformWithParentMessage utm = new UpdateTransformWithParentMessage(object.getObjectID(), dataTransform.getCellId(), dataTransform.getTransformedX(), dataTransform.getTransformedY(), dataTransform.getTransformedZ(), dataTransform.getMovementCounter(), (byte) dataTransform.getMovementAngle(), dataTransform.getSpeed(), object.getCombatFlag());
+
+
+ if(object.getContainer() != parent) {
+ remove(object, oldPos.x, oldPos.z);
+ if(object.getContainer() != null)
+ object.getContainer()._remove(object);
+ parent._add(object);
+ }
+ object.setPosition(newPos);
+ object.setOrientation(newOrientation);
+ object.setMovementCounter(dataTransform.getMovementCounter());
+ object.notifyObservers(utm, false);
+
+ }
+
+
+ });
+
+ swgOpcodes.put(Opcodes.ClientOpenContainerMessage, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+ System.out.println("Open Container Request");
+ }
+
+ });
+
+ objControllerOpcodes.put(ObjControllerOpcodes.TARGET_UPDATE, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+
+ data = data.order(ByteOrder.LITTLE_ENDIAN);
+ data.position(0);
+
+ Client client = core.getClient((Integer) session.getAttribute("connectionId"));
+
+ if(client == null) {
+ System.out.println("NULL Client");
+ return;
+ }
+
+ if(client.getParent() == null) {
+ System.out.println("NULL Object");
+ return;
+ }
+ CreatureObject object = (CreatureObject) client.getParent();
+
+ TargetUpdate targetUpdate = new TargetUpdate();
+ targetUpdate.deserialize(data);
+
+ object.setTargetId(targetUpdate.getTargetId());
+
+ }
+
+ });
+
+ }
+
+ @Override
+ public void shutdown() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public WB_AABBTree getAABBTree(SWGObject object, int collisionBlockFlag) {
+
+ if(object.getMeshVisitor() == null || object.getTemplateData() == null) {
+ System.out.println("NULL Mesh Visitor for: " + object.getTemplate());
+ return null;
+ }
+
+ if(object.getTemplateData().getAttribute("collisionActionBlockFlags") != null) {
+ int bit = (Integer) object.getTemplateData().getAttribute("collisionActionBlockFlags") & collisionBlockFlag;
+
+ if(bit == (Integer) object.getTemplateData().getAttribute("collisionActionBlockFlags"))
+ return null;
+ }
+
+ Point3D position = object.getPosition();
+ HE_Mesh mesh = object.getMeshVisitor().createMesh();
+
+ if(mesh == null)
+ return null;
+ System.out.println(object.getHeading());
+ float angle = (float) (object.getRadians() * (180 / Math.PI));
+ System.out.println("Angle: " + angle);
+
+ Quaternion quat = object.getOrientation();
+
+ WB_Transform transform = new WB_Transform().addRotateZ(object.getRadians());
+ mesh = mesh.move(position.x, position.z, position.y).transform(transform);
+ mesh.clean();
+ mesh.cleanUnusedElementsByFace();
+ WB_AABBTree aabbTree = new WB_AABBTree(mesh, mesh.numberOfFaces());
+ return aabbTree;
+ }
+
+ public WB_Ray convertRayToModelSpace(WB_Ray ray, SWGObject object) {
+
+ WB_Transform transform = new WB_Transform().addTranslate(new WB_Point3d(-object.getPosition().x, -object.getPosition().z , -object.getPosition().y)).addRotateZ(object.getRadians());
+ ray = transform.apply(ray);
+
+ return ray;
+
+ }
+
+ public void handleDisconnect(IoSession session) {
+
+ Client client = core.getClient((Integer) session.getAttribute("connectionId"));
+
+ if(client == null)
+ return;
+
+ if(client.getParent() == null)
+ return;
+
+ CreatureObject object = (CreatureObject) client.getParent();
+ boolean remove = remove(object, object.getPosition().x, object.getPosition().z);
+ if(remove)
+ System.out.println("Successful quadtree remove");
+
+ HashSet oldObservers = new HashSet(object.getObservers());
+ for(Iterator it = oldObservers.iterator(); it.hasNext();) {
+ Client observerClient = it.next();
+ if(observerClient.getParent() != null) {
+ observerClient.getParent().makeUnaware(object);
+ }
+ }
+
+ object.createTransaction(core.getCreatureODB().getEnvironment());
+ core.getCreatureODB().put(object, Long.class, CreatureObject.class, object.getTransaction());
+ object.getTransaction().commitSync();
+
+ session.suspendRead();
+ session.suspendWrite();
+ core.objectService.destroyObject(object);
+ core.getActiveConnectionsMap().remove((Integer) session.getAttribute("connectionId"));
+ }
+
+ public void handleZoneIn(Client client) {
+
+ if(client.getParent() == null)
+ return;
+
+ CreatureObject object = (CreatureObject) client.getParent();
+ Quaternion orientation = object.getOrientation();
+ Point3D position = object.getPosition();
+
+ if(object.getParentId() != 0) {
+ SWGObject parent = core.objectService.getObject(object.getParentId());
+ parent._add(object);
+ }
+
+ Point3D pos = object.getWorldPosition();
+
+ Collection newAwareObjects = get(object.getPlanet(), pos.x, pos.z, 200);
+ for(Iterator it = newAwareObjects.iterator(); it.hasNext();) {
+ SWGObject obj = it.next();
+ object.makeAware(obj);
+ if(obj.getClient() != null)
+ obj.makeAware(object);
+ }
+
+ if(object.getParentId() == 0)
+ add(object, pos.x, pos.z);
+
+ //teleport(object, position, orientation);
+
+ //core.chatService.loadMailHeaders(client); // moved to beginning of zone-in like live
+
+ }
+
+ public void openContainer(SWGObject requester, SWGObject container) {
+
+ if(container.getPermissions().canView(requester, container)) {
+ OpenedContainerMessage opm = new OpenedContainerMessage(container.getObjectID());
+ if(requester.getClient() != null && requester.getClient().getSession() != null)
+ requester.getClient().getSession().write(opm.serialize());
+ }
+
+ }
+
+ public void teleport(SWGObject obj, Point3D position, Quaternion orientation) {
+
+ if(position.x >= -8192 && position.x <= 8192 && position.z >= -8192 && position.z <= 8192) {
+
+ if(obj.getParentId() == 0) {
+ DataTransform dataTransform = new DataTransform(new Point3D(position.x, 0, position.z), orientation, obj.getMovementCounter(), obj.getObjectID());
+ ObjControllerMessage objController = new ObjControllerMessage(0x1B, dataTransform);
+ obj.notifyObservers(objController, true);
+ } else {
+ DataTransformWithParent dataTransform = new DataTransformWithParent(new Point3D(position.x, 0, position.z), orientation, obj.getMovementCounter(), obj.getObjectID(), obj.getParentId());
+ ObjControllerMessage objController = new ObjControllerMessage(0x1B, dataTransform);
+ obj.notifyObservers(objController, true);
+ }
+
+ }
+
+ }
+ // not fully working yet(rotation of meshes wrong)
+ public boolean checkLineOfSight(SWGObject obj1, SWGObject obj2) {
+
+ if(obj1.getPlanet() != obj2.getPlanet())
+ return false;
+
+ if((obj1.getContainer() != null && obj2.getContainer() != null) && (obj1.getContainer() == obj2.getContainer())) // if both are in same cell they should always be in sight of each other
+ return true;
+
+ if(obj1.getGrandparent() != null && obj2.getGrandparent() != null) {
+
+ if(obj1.getGrandparent() == obj2.getGrandparent())
+ return checkLineOfSightInBuilding(obj1, obj2, obj1.getGrandparent());
+ else
+ return false;
+ }
+
+ float heightOrigin = 1.f;
+ float heightDirection = 1.f;
+
+ if(obj1 instanceof CreatureObject)
+ heightOrigin = getHeightOrigin((CreatureObject) obj1);
+
+ if(obj2 instanceof CreatureObject)
+ heightDirection = getHeightOrigin((CreatureObject) obj2);
+
+ Point3D position1 = obj1.getWorldPosition();
+ Point3D position2 = obj2.getWorldPosition();
+
+ Vector3D origin = new Vector3D(position1.x, position1.z, position1.y + heightOrigin);
+ Vector3D end = new Vector3D(position2.x, position2.z, position2.y + heightDirection);
+
+ float distance = position1.getDistance2D(position2);
+
+ List inRangeObjects = get(obj1.getPlanet(), position1.x, position1.z, (int) distance + 1);
+
+
+ WB_Ray ray = new WB_Ray(origin.getX(), origin.getY() , origin.getZ(), end.getX(), end.getY(), end.getZ());
+
+ for(SWGObject object : inRangeObjects) {
+
+ if(object == obj1 || object == obj2)
+ continue;
+
+ Point3D position = object.getWorldPosition();
+ float otherDistance = position.getDistance2D(position1);
+ System.out.println("Distance from origin to target: " + distance + " Distance from origin to current obj: " + otherDistance);
+ if(!obj1.inRange(position, distance))
+ continue;
+
+ WB_AABBTree aabbTree = getAABBTree(object, 255);
+
+ if(aabbTree == null)
+ continue;
+
+ //System.out.println(object.getTemplate());
+
+ //ray = convertRayToModelSpace(ray, object);
+
+ ArrayList collisions = WB_Intersection.getIntersection(ray, aabbTree);
+ if(!collisions.isEmpty()) {
+ System.out.println("Collided with " + object.getTemplate() + " X: " + object.getPosition().x + " Y: " + object.getPosition().y + " Z: " + object.getPosition().z);
+ return false;
+ }
+
+ }
+
+
+ /*if(obj1.getContainer() != null || obj2.getContainer() != null) {
+
+ CellObject cell = null;
+
+ if(obj1.getContainer() != null && obj1.getContainer() instanceof CellObject)
+ cell = (CellObject) obj1.getContainer();
+ else if(obj2.getContainer() != null && obj2.getContainer() instanceof CellObject)
+ cell = (CellObject) obj2.getContainer();
+
+ if(cell != null)
+ return checkLineOfSightWorldToCell(obj1, obj2, cell);
+ }*/
+
+ return true;
+
+ }
+
+ // not fully working yet(rotation of meshes wrong)
+ public boolean checkLineOfSightInBuilding(SWGObject obj1, SWGObject obj2, SWGObject building) {
+
+ PortalVisitor portalVisitor = building.getPortalVisitor();
+
+ if(portalVisitor == null)
+ return true;
+
+ Point3D position1 = obj1.getPosition();
+ Point3D position2 = obj2.getPosition();
+
+
+ Vector3D origin = new Vector3D(position1.x, position1.z, position1.y + 1);
+ Vector3D end = new Vector3D(position2.x, position2.z, position2.y + 1);
+
+ //Vector3D direction = end.subtract(origin).normalize();
+
+ WB_Ray ray = new WB_Ray(origin.getX(), origin.getY(), origin.getZ(), end.getX(), end.getY(), end.getZ());
+
+ for(int i = 1; i < portalVisitor.cells.size(); i++) {
+
+ Cell cell = portalVisitor.cells.get(i);
+ System.out.println(cell.name);
+ try {
+ System.out.println(cell.mesh);
+ MeshVisitor meshVisitor = ClientFileManager.loadFile(cell.mesh, MeshVisitor.class);
+ WB_AABBTree aabbTree = meshVisitor.getAABBTree(meshVisitor.createMesh());
+
+ if(aabbTree == null)
+ continue;
+
+ ArrayList collisions = WB_Intersection.getIntersection(ray, aabbTree);
+
+ if(!collisions.isEmpty()) {
+ System.out.println("Collision with: " + cell.name);
+ return false;
+ }
+
+ } catch (InstantiationException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ return true;
+
+ }
+
+ // not fully working yet(rotation of meshes wrong)
+ public boolean checkLineOfSightWorldToCell(SWGObject obj1, SWGObject obj2, CellObject cell) {
+
+ SWGObject building = cell.getContainer();
+
+ if(building == null)
+ return true;
+
+ PortalVisitor portalVisitor = building.getPortalVisitor();
+
+ if(portalVisitor == null)
+ return true;
+
+ float heightOrigin = 1.f;
+ float heightDirection = 1.f;
+
+ if(obj1 instanceof CreatureObject)
+ heightOrigin = getHeightOrigin((CreatureObject) obj1);
+
+ if(obj2 instanceof CreatureObject)
+ heightDirection = getHeightOrigin((CreatureObject) obj2);
+
+ Point3D position1 = obj1.getWorldPosition();
+ Point3D position2 = obj2.getWorldPosition();
+
+ Point3D origin = new Point3D(position1.x, position1.z, position1.y + heightOrigin);
+ Point3D direction = new Point3D(position2.x, position2.z, position2.y + heightDirection);
+
+ WB_Ray ray = new WB_Ray(origin.x, origin.y , origin.z, direction.x, direction.y, direction.z);
+ ray = convertRayToModelSpace(ray, building);
+
+ if(cell.getCellNumber() >= portalVisitor.cellCount)
+ return true;
+
+ try {
+ MeshVisitor meshVisitor = ClientFileManager.loadFile(portalVisitor.cells.get(cell.getCellNumber()).mesh, MeshVisitor.class);
+ WB_AABBTree aabbTree = meshVisitor.getAABBTree(meshVisitor.createMesh());
+ ArrayList collisions = WB_Intersection.getIntersection(ray, aabbTree);
+
+ if(!collisions.isEmpty())
+ return false;
+
+ } catch (InstantiationException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+
+ return true;
+ }
+
+ public float getHeightOrigin(CreatureObject creature) {
+
+ float height = (float) (creature.getHeight() - 0.3);
+
+ if(creature.getPosture() == 2 || creature.getPosture() == 13)
+ height = 0.3f;
+ else if(creature.getPosture() == 1)
+ height /= 2.f;
+
+ return height;
+
+ }
+
+}
diff --git a/src/services/StaticService.java b/src/services/StaticService.java
new file mode 100644
index 00000000..42019b6b
--- /dev/null
+++ b/src/services/StaticService.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services;
+
+public class StaticService {
+
+}
diff --git a/src/services/TerrainService.java b/src/services/TerrainService.java
new file mode 100644
index 00000000..69009fa3
--- /dev/null
+++ b/src/services/TerrainService.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import engine.resources.scene.Planet;
+
+
+import main.NGECore;
+
+public class TerrainService {
+
+ private NGECore core;
+ private List planets = Collections.synchronizedList(new ArrayList());
+
+ public TerrainService(NGECore core) {
+
+ this.core = core;
+
+ }
+
+ public boolean isWater(int planetId, float x, float z) {
+
+ if(getPlanetByID(planetId) == null)
+ return false;
+
+ Planet planet = getPlanetByID(planetId);
+
+ return planet.getTerrainVisitor().isWater(x, z);
+
+ }
+
+ public boolean isWater(Planet planet, float x, float z) {
+
+ if(!planets.contains(planet))
+ return false;
+
+ return planet.getTerrainVisitor().isWater(x, z);
+
+ }
+
+
+ public float getHeight(int planetId, float x, float z) {
+
+ if(getPlanetByID(planetId) == null)
+ return Float.NaN;
+ Planet planet = getPlanetByID(planetId);
+ float height = planet.getTerrainVisitor().getHeight(x, z);
+ System.out.println("Height: " + height);
+ return height;
+ }
+
+
+ public List getPlanetList() {
+ return planets;
+ }
+
+ public Planet getPlanetByID(int ID) {
+ for (int i = 0; i < planets.size(); i++) {
+ if (planets.get(i).getID() == ID) {
+ return planets.get(i);
+ }
+ }
+
+ return null;
+ }
+
+ public Planet getPlanetByName(String name) {
+ for (int i = 0; i < planets.size(); i++) {
+ if (planets.get(i).getName() == name) {
+ return planets.get(i);
+ }
+ }
+
+ return null;
+ }
+
+ public Planet getPlanetByPath(String path) {
+ for (int i = 0; i < planets.size(); i++) {
+ if (planets.get(i).getPath() == path) {
+ return planets.get(i);
+ }
+ }
+
+ return null;
+ }
+
+ public void addPlanet(int ID, String name, String path, boolean loadSnapshot) {
+ Planet planet = new Planet(ID, name, path, loadSnapshot);
+ planets.add(planet);
+ }
+
+
+ public void loadSnapShotObjects() {
+
+ for(Planet planet : planets) {
+
+ if(planet.getSnapshotVisitor() != null) {
+
+ core.objectService.loadSnapshotObjects(planet);
+
+ }
+
+ }
+
+ }
+
+
+
+
+}
diff --git a/src/services/TravelService.java b/src/services/TravelService.java
new file mode 100644
index 00000000..dd5c5dc4
--- /dev/null
+++ b/src/services/TravelService.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services;
+
+public class TravelService {
+
+}
diff --git a/src/services/WeatherService.java b/src/services/WeatherService.java
new file mode 100644
index 00000000..8fb1cd1c
--- /dev/null
+++ b/src/services/WeatherService.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services;
+
+public class WeatherService {
+
+}
diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java
new file mode 100644
index 00000000..14805415
--- /dev/null
+++ b/src/services/chat/ChatService.java
@@ -0,0 +1,426 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services.chat;
+
+import java.nio.ByteOrder;
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledExecutorService;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IoSession;
+
+import com.sleepycat.je.Transaction;
+import com.sleepycat.persist.EntityCursor;
+
+import engine.clients.Client;
+import engine.resources.config.Config;
+import engine.resources.config.DefaultConfig;
+import engine.resources.database.ObjectDatabase;
+import engine.resources.objects.SWGObject;
+import engine.resources.scene.Point3D;
+import engine.resources.service.INetworkDispatch;
+import engine.resources.service.INetworkRemoteEvent;
+import resources.common.*;
+
+import protocol.swg.ChatDeletePersistentMessage;
+import protocol.swg.ChatInstantMessageToCharacter;
+import protocol.swg.ChatInstantMessagetoClient;
+import protocol.swg.ChatOnSendInstantMessage;
+import protocol.swg.ChatOnSendPersistentMessage;
+import protocol.swg.ChatPersistentMessageToClient;
+import protocol.swg.ChatPersistentMessageToServer;
+import protocol.swg.ChatRequestPersistentMessage;
+import protocol.swg.ObjControllerMessage;
+import protocol.swg.objectControllerObjects.PlayerEmote;
+import protocol.swg.objectControllerObjects.SpatialChat;
+import main.NGECore;
+
+
+public class ChatService implements INetworkDispatch {
+
+ private NGECore core;
+ private ObjectDatabase mailODB;
+
+ public ChatService(NGECore core) {
+ this.core = core;
+ core.commandService.registerCommand("spatialchatinternal");
+ core.commandService.registerCommand("socialinternal");
+ mailODB = core.getMailODB();
+ }
+
+ public void handleSpatialChat(SWGObject speaker, SWGObject target, String chatMessage, short chatType, short moodId) {
+
+ long targetId;
+
+ if(target == null)
+ targetId = 0;
+ else
+ targetId = target.getObjectID();
+
+ //System.out.println(chatMessage);
+ //System.out.println(chatType);
+ //System.out.println(moodId);
+
+ SpatialChat spatialChat = new SpatialChat(speaker.getObjectID(), targetId, chatMessage, chatType, moodId);
+ ObjControllerMessage objControllerMessage = new ObjControllerMessage(0x0B, spatialChat);
+
+ Client speakerClient = speaker.getClient();
+
+ if(speakerClient == null || speakerClient.getSession() == null)
+ return;
+
+ speakerClient.getSession().write(objControllerMessage.serialize());
+
+ if(speaker.getObservers().isEmpty())
+ return;
+
+ HashSet observers = new HashSet(speaker.getObservers());
+
+ Point3D position = speaker.getPosition();
+
+ for(Client client : observers) {
+ float distance = client.getParent().getPosition().getDistance2D(position);
+ if(client != null && client.getSession() != null && distance <= 80) {
+ spatialChat.setDestinationId(client.getParent().getObjectID());
+ ObjControllerMessage objControllerMessage2 = new ObjControllerMessage(0x0B, spatialChat);
+ client.getSession().write(objControllerMessage2.serialize());
+ }
+ }
+
+ }
+
+ public void handleEmote(SWGObject speaker, SWGObject target, short emoteId) {
+
+ long targetId;
+
+ if(target == null)
+ targetId = 0;
+ else
+ targetId = target.getObjectID();
+
+ PlayerEmote emote = new PlayerEmote(speaker.getObjectID(), targetId, emoteId);
+ ObjControllerMessage objControllerMessage = new ObjControllerMessage(0x0B, emote);
+ //System.out.println("Emote ID: " + emoteId);
+ Client speakerClient = speaker.getClient();
+
+ if(speakerClient == null || speakerClient.getSession() == null)
+ return;
+
+ speakerClient.getSession().write(objControllerMessage.serialize());
+
+ if(speaker.getObservers().isEmpty())
+ return;
+
+ HashSet observers = new HashSet(speaker.getObservers());
+
+ Point3D position = speaker.getPosition();
+
+ for(Client client : observers) {
+ float distance = client.getParent().getPosition().getDistance2D(position);
+ if(client != null && client.getSession() != null && distance <= 80) {
+ emote.setDestinationId(client.getParent().getObjectID());
+ ObjControllerMessage objControllerMessage2 = new ObjControllerMessage(0x0B, emote);
+ client.getSession().write(objControllerMessage2.serialize());
+ }
+ }
+
+ }
+
+ @Override
+ public void insertOpcodes( Map swgOpcodes, Map objControllerOpcodes) {
+
+ swgOpcodes.put(Opcodes.ChatInstantMessageToCharacter, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+
+ data = data.order(ByteOrder.LITTLE_ENDIAN);
+ data.position(0);
+
+ ChatInstantMessageToCharacter chatInstantMsg = new ChatInstantMessageToCharacter();
+ chatInstantMsg.deserialize(data);
+ String firstName = chatInstantMsg.getRecipient();
+
+ Client client = core.getClient((Integer) session.getAttribute("connectionId"));
+
+ if(client == null)
+ return;
+
+ SWGObject sender = client.getParent();
+
+ if(sender == null)
+ return;
+
+
+
+ SWGObject recipient = getObjectByFirstName(firstName);
+
+ if(recipient == null || recipient.getClient() == null || recipient.getClient().getSession() == null) {
+ ChatOnSendInstantMessage response = new ChatOnSendInstantMessage(4, chatInstantMsg.getSequence());
+ //System.out.println(response.serialize().getHexDump());
+ session.write(response.serialize());
+ } else {
+ ChatOnSendInstantMessage response = new ChatOnSendInstantMessage(0, chatInstantMsg.getSequence());
+ session.write(response.serialize());
+ ChatInstantMessagetoClient msg = new ChatInstantMessagetoClient(chatInstantMsg.getGalaxy(), chatInstantMsg.getMessage(), sender.getCustomName().split(" ")[0]);
+ recipient.getClient().getSession().write(msg.serialize());
+ }
+
+
+ }
+
+ });
+
+ swgOpcodes.put(Opcodes.ChatPersistentMessageToServer, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+
+ data = data.order(ByteOrder.LITTLE_ENDIAN);
+ data.position(0);
+
+ ChatPersistentMessageToServer packet = new ChatPersistentMessageToServer();
+ packet.deserialize(data);
+
+ Client client = core.getClient((Integer) session.getAttribute("connectionId"));
+
+ if(client == null)
+ return;
+
+ SWGObject sender = client.getParent();
+
+ if(sender == null)
+ return;
+
+ SWGObject recipient = getObjectByFirstName(packet.getRecipient());
+
+ if(recipient == null || recipient.getSlottedObject("ghost" ) == null) {
+ ChatOnSendPersistentMessage response = new ChatOnSendPersistentMessage(4, packet.getCounter());
+ session.write(response.serialize());
+ //System.out.println(packet.getRecipient());
+ } else {
+ Date date = new Date();
+ Mail mail = new Mail();
+ mail.setMailId(generateMailId());
+ mail.setMessage(packet.getMessage());
+ mail.setRecieverId(recipient.getObjectID());
+ mail.setSenderName(sender.getCustomName().split(" ")[0]);
+ mail.setStatus(Mail.NEW);
+ mail.setSubject(packet.getSubject());
+ mail.setTimeStamp((int) (date.getTime() / 1000));
+
+ storePersistentMessage(mail);
+
+ if(recipient.getClient() != null) {
+ sendPersistentMessageHeader(recipient.getClient(), mail);
+ }
+
+ ChatOnSendPersistentMessage response = new ChatOnSendPersistentMessage(0, packet.getCounter());
+ session.write(response.serialize());
+ }
+ }
+
+ });
+
+ swgOpcodes.put(Opcodes.ChatRequestPersistentMessage, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+
+ data = data.order(ByteOrder.LITTLE_ENDIAN);
+ data.position(0);
+
+ ChatRequestPersistentMessage packet = new ChatRequestPersistentMessage();
+ packet.deserialize(data);
+
+ Client client = core.getClient((Integer) session.getAttribute("connectionId"));
+
+ if(client == null)
+ return;
+
+ SWGObject obj = client.getParent();
+ Mail mail = mailODB.get(new Integer(packet.getMailId()), Integer.class, Mail.class);
+
+ if(obj == null || mail == null)
+ return;
+
+ if(mail.getRecieverId() != obj.getObjectID())
+ return;
+
+ mail.setStatus(Mail.READ);
+
+ sendPersistentMessage(client, mail);
+
+ storePersistentMessage(mail);
+
+ }
+
+ });
+
+ swgOpcodes.put(Opcodes.ChatDeletePersistentMessage, new INetworkRemoteEvent() {
+
+ @Override
+ public void handlePacket(IoSession session, IoBuffer data) throws Exception {
+
+ data = data.order(ByteOrder.LITTLE_ENDIAN);
+ data.position(0);
+
+ ChatDeletePersistentMessage packet = new ChatDeletePersistentMessage();
+ packet.deserialize(data);
+
+ Client client = core.getClient((Integer) session.getAttribute("connectionId"));
+
+ if(client == null)
+ return;
+
+ SWGObject obj = client.getParent();
+ Mail mail = mailODB.get(new Integer(packet.getMailId()), Integer.class, Mail.class);
+
+ if(obj == null || mail == null)
+ return;
+
+ if(mail.getRecieverId() != obj.getObjectID())
+ return;
+
+ deletePersistentMessage(mail);
+ }
+
+ });
+
+ }
+
+ public void sendPersistentMessageHeader(Client client, Mail mail) {
+
+ if(client.getSession() == null)
+ return;
+
+ Config config = new Config();
+ config.setFilePath("nge.cfg");
+ if (!(config.loadConfigFile())) {
+ config = DefaultConfig.getConfig();
+ }
+
+ //System.out.println(config.getString("GALAXY_NAME"));
+
+ ChatPersistentMessageToClient msg = new ChatPersistentMessageToClient(mail.getSenderName(), config.getString("GALAXY_NAME"), mail.getMailId()
+ ,(byte) 1, "", mail.getSubject(), mail.getStatus(), mail.getTimeStamp());
+
+ client.getSession().write(msg.serialize());
+ }
+
+ public void sendPersistentMessage(Client client, Mail mail) {
+
+ if(client.getSession() == null)
+ return;
+
+ Config config = new Config();
+ config.setFilePath("nge.cfg");
+ if (!(config.loadConfigFile())) {
+ config = DefaultConfig.getConfig();
+ }
+
+ //System.out.println(config.getString("GALAXY_NAME"));
+
+ ChatPersistentMessageToClient msg = new ChatPersistentMessageToClient(mail.getSenderName(), config.getString("GALAXY_NAME"), mail.getMailId()
+ ,(byte) 0, mail.getMessage(), mail.getSubject(), mail.getStatus(), mail.getTimeStamp());
+
+ client.getSession().write(msg.serialize());
+ }
+
+
+ public void storePersistentMessage(Mail mail) {
+ Transaction txn = mailODB.getEnvironment().beginTransaction(null, null);
+ mailODB.put(mail, Integer.class, Mail.class, txn);
+ txn.commitSync();
+ }
+
+ 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();
+ }
+
+ public void loadMailHeaders(Client client) {
+
+ SWGObject obj = client.getParent();
+
+ if(obj == null || client.getSession() == null)
+ return;
+
+ EntityCursor cursor = mailODB.getCursor(Integer.class, Mail.class);
+
+ for(Mail mail : cursor) {
+
+ if(mail.getRecieverId() == obj.getObjectID())
+ sendPersistentMessageHeader(client, mail);
+
+ }
+
+ }
+
+ @Override
+ public void shutdown() {
+
+ }
+
+ public SWGObject getObjectByFirstName(String name) {
+ ConcurrentHashMap clients = core.getActiveConnectionsMap();
+
+ for(Client client : clients.values()) {
+ if(client.getParent() == null)
+ continue;
+
+ String fullName = client.getParent().getCustomName();
+ String firstName = fullName.split(" ")[0];
+
+ if(firstName.equalsIgnoreCase(name))
+ return client.getParent();
+ }
+ return null;
+ }
+
+ public int generateMailId() {
+ Random rand = new Random();
+
+ int id = rand.nextInt();
+
+ if(mailODB.contains(new Integer(id), Integer.class, Mail.class))
+ return generateMailId();
+ else
+ return id;
+ }
+
+ public Mail getMailById(int mailId) {
+
+ Mail mail = mailODB.get(new Integer(mailId), Integer.class, Mail.class);
+ return mail;
+
+ }
+
+}
diff --git a/src/services/chat/Mail.java b/src/services/chat/Mail.java
new file mode 100644
index 00000000..cf811a62
--- /dev/null
+++ b/src/services/chat/Mail.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services.chat;
+
+import com.sleepycat.persist.model.Entity;
+import com.sleepycat.persist.model.PrimaryKey;
+
+@Entity
+public class Mail {
+
+ @PrimaryKey
+ private int mailId;
+ private String senderName;
+ private long recieverId;
+ private String subject;
+ private String message;
+ private byte status;
+ private int timeStamp;
+
+ public static final byte NEW = 0x4E;
+ public static final byte READ = 0x52;
+ public static final byte UNREAD = 0x55;
+
+
+ public Mail() {
+
+ }
+
+
+ public int getMailId() {
+ return mailId;
+ }
+
+
+ public void setMailId(int mailId) {
+ this.mailId = mailId;
+ }
+
+
+ public String getSenderName() {
+ return senderName;
+ }
+
+
+ public void setSenderName(String senderName) {
+ this.senderName = senderName;
+ }
+
+
+ public long getRecieverId() {
+ return recieverId;
+ }
+
+
+ public void setRecieverId(long recieverId) {
+ this.recieverId = recieverId;
+ }
+
+
+ public String getSubject() {
+ return subject;
+ }
+
+
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
+
+
+ public String getMessage() {
+ return message;
+ }
+
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+
+ public byte getStatus() {
+ return status;
+ }
+
+
+ public void setStatus(byte status) {
+ this.status = status;
+ }
+
+
+ public int getTimeStamp() {
+ return timeStamp;
+ }
+
+
+ public void setTimeStamp(int timeStamp) {
+ this.timeStamp = timeStamp;
+ }
+
+}
diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java
new file mode 100644
index 00000000..ba91f070
--- /dev/null
+++ b/src/services/combat/CombatService.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services.combat;
+
+public class CombatService {
+
+}
diff --git a/src/services/command/BaseSWGCommand.java b/src/services/command/BaseSWGCommand.java
new file mode 100644
index 00000000..7fc55a42
--- /dev/null
+++ b/src/services/command/BaseSWGCommand.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
+ * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
+ ******************************************************************************/
+package services.command;
+
+import engine.resources.common.CRC;
+
+public class BaseSWGCommand {
+
+ private String commandName;
+ private String clientEffectSelf;
+ private String clientEffectTarget;
+ private int maxRangeToTarget;
+ private int commandCRC;
+
+ public BaseSWGCommand(String commandName) {
+ setCommandName(commandName);
+ setCommandCRC(CRC.StringtoCRC(commandName));
+ }
+
+ public String getCommandName() {
+ return commandName;
+ }
+
+ public void setCommandName(String commandName) {
+ this.commandName = commandName;
+ }
+
+ public String getClientEffectSelf() {
+ return clientEffectSelf;
+ }
+
+ public void setClientEffectSelf(String clientEffectSelf) {
+ this.clientEffectSelf = clientEffectSelf;
+ }
+
+ public String getClientEffectTarget() {
+ return clientEffectTarget;
+ }
+
+ public void setClientEffectTarget(String clientEffectTarget) {
+ this.clientEffectTarget = clientEffectTarget;
+ }
+
+ public int getMaxRangeToTarget() {
+ return maxRangeToTarget;
+ }
+
+ public void setMaxRangeToTarget(int maxRangeToTarget) {
+ this.maxRangeToTarget = maxRangeToTarget;
+ }
+
+ public int getCommandCRC() {
+ return commandCRC;
+ }
+
+ public void setCommandCRC(int commandCRC) {
+ this.commandCRC = commandCRC;
+ }
+
+}
diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java
new file mode 100644
index 00000000..2739184b
--- /dev/null
+++ b/src/services/command/CommandService.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2013
+ *
+ * This File is part of NGECore2.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see