This commit is contained in:
Waverunner
2014-08-11 10:56:01 -04:00
6 changed files with 302 additions and 304 deletions
+250
View File
@@ -0,0 +1,250 @@
import sys
from engine.resources.scene import Point3D
from protocol.swg import ObjControllerMessage
from protocol.swg import UnknownAbilityPacket
from protocol.swg import PlayClientEffectLocMessage
from engine.resources.objects import SWGObject
from java.awt.datatransfer import StringSelection
from java.awt.datatransfer import Clipboard
from java.awt import Toolkit
from resources.datatables import GcwRank
from services.gcw import GCWService
def setup():
return
def run(core, actor, target, commandString):
playerObject = actor.getSlottedObject('ghost')
global str
if not playerObject:
return
commandArgs = commandString.split(' ')
command = commandArgs[0]
if len(commandArgs) > 1:
arg1 = commandArgs[1]
if len(commandArgs) > 2:
arg2 = commandArgs[2]
if len(commandArgs) > 3:
arg3 = commandArgs[3]
if len(commandArgs) > 4:
arg4 = commandArgs[4]
if len(commandArgs) > 5:
arg5 = commandArgs[5]
if command == 'giveExperience' and arg1:
core.playerService.giveExperience(actor, int(arg1))
if command == 'level' and arg1:
core.playerService.grantLevel(actor, int(arg1))
elif command == 'addability' and arg1:
actor.addAbility(str(arg1))
actor.sendSystemMessage('You have learned ' + arg1 + '.', 0)
elif command == 'anim' and arg1:
actor.doSkillAnimation(arg1)
actor.sendSystemMessage('Performed ' + arg1 ,0)
elif command == 'changeBio' and arg1:
actor.getSlottedObject('ghost').setBiography(arg1)
elif command == 'spawn' and arg1 and arg2:
pos = actor.getWorldPosition()
core.spawnService.spawnCreature(arg1, actor.getPlanet().getName(), 0, pos.x, pos.y, pos.z, 1, 0, 1, 0, int(arg2))
elif command == 'instance' and arg1:
core.instanceService.queue(arg1, actor)
elif command == 'action' and arg1:
actor.setAction(int(arg1))
elif command == 'health' and arg1:
actor.setHealth(int(arg1))
elif command == 'cust' and arg1 and arg2 and arg3:
obj = core.objectService.getObject(long(arg1))
obj.setCustomizationVariable(str(arg2), int(arg3))
elif command == 'buff' and arg1:
core.buffService.addBuffToCreature(actor, str(arg1), actor)
elif command == 'holoEmote' and arg1:
playerObject.setHoloEmote('holoemote_' + arg1)
playerObject.setHoloEmoteUses(20)
actor.sendSystemMessage('Holo-Emote Generator set to ' + 'holoemote_' + arg1, 0)
elif command == 'off':
if playerObject.getGodLevel > 0:
actor.removeAbility("admin")
playerObject.setGodLevel(0)
elif command == 'setBounty':
if actor.getFaction() == "":
actor.sendSystemMessage('You must be aligned in order to place a bounty on yourself.', 0)
return
core.playerService.sendSetBountyWindow(actor, actor)
return
elif command == 'genloot':
object = core.lootService.generateLootItem(actor, arg1)
inventory = actor.getSlottedObject('inventory')
if inventory:
inventory.add(object)
elif command == 'spawnobj':
pos = actor.getPosition()
core.staticService.spawnObject(arg1, actor.getPlanet().getName(), 0, pos.x, pos.y, pos.z, 0, 0)
elif command == 'showpos':
pos = actor.getPosition()
ori = actor.getOrientation()
cellid = 0
planetName = actor.getPlanet().getName()
actor.sendSystemMessage('Position.x : %s' % pos.x, 0)
print ('Position.x : %s' % pos.x, 0)
actor.sendSystemMessage('Position.y : %s' % pos.y, 0)
print ('Position.y : %s' % pos.y, 0)
actor.sendSystemMessage('Position.z : %s' % pos.z, 0)
print ('Position.z : %s' % pos.z, 0)
actor.sendSystemMessage('Orientation.w : %s' % ori.w, 0)
print ('Orientation.x : %s' % ori.w, 0)
actor.sendSystemMessage('Orientation.x : %s' % ori.x, 0)
print ('Orientation.w : %s' % ori.x, 0)
actor.sendSystemMessage('Orientation.y : %s' % ori.y, 0)
print ('Orientation.y : %s' % ori.y, 0)
actor.sendSystemMessage('Orientation.z : %s' % ori.z, 0)
print ('Orientation.z : %s' % ori.z, 0)
if (actor.getContainer()):
building_id = actor.getGrandparent().getObjectID()
cid = actor.getContainer().getCellNumber()
cellid = cid
actor.sendSystemMessage('Cell ID : %s' % cid, 0)
actor.sendSystemMessage('Building ID : %s' % building_id, 0)
print('Cell ID : %s' % cid, 0)
print('Building ID : %s' % building_id, 0)
if cellid == 0:
str = "<OBJECTNAME> = stcSvc.spawnObject('<MOBILENAME>', '" + planetName + "', long(%s" % cellid + "), float(%.4f" % pos.x + "), float(%.4f" % pos.y + "), float(%.4f" % pos.z + "), float(%.4f" % ori.w + "), float(%.4f" % ori.x + "), float(%.4f" % ori.y + "), float(%.4f" % ori.z + "))"
elif cellid != 0:
str = "\tbuilding = core.objectService.getObject(long(%s" % building_id + "))\n\t<OBJECTNAME> = stcSvc.spawnObject('<MOBILENAME>', '" + planetName + "', building.getCellByCellNumber(long(%s" % cellid + ")), float(%.4f" % pos.x + "), float(%.4f" % pos.y + "), float(%.4f" % pos.z + "), float(%.4f" % ori.w + "), float(%.4f" % ori.x + "), float(%.4f" % ori.y + "), float(%.4f" % ori.z + "))"
toolkit = Toolkit.getDefaultToolkit()
clipboard = toolkit.getSystemClipboard()
clipboard.setContents(StringSelection(str), None)
elif command == 'patrolpoint':
pos = actor.getPosition()
str = "patrolpoints.add(Point3D(float(%.2f" % pos.x + "), float(%.2f" % pos.y + "), float(%.2f" % pos.z + ")))"
toolkit = Toolkit.getDefaultToolkit()
clipboard = toolkit.getSystemClipboard()
clipboard.setContents(StringSelection(str), None)
actor.sendSystemMessage('Patrolpoint copied to clipboard', 0)
elif command == 'checkai':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
actor.sendSystemMessage('Checking AI handling for unit ' + latarget.getCustomName(), 0)
core.aiService.setCheckAI(latarget)
elif command == 'checkaitarget':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
if latarget.getAttachment('AI'):
if latarget.getAttachment('AI').getFollowObject():
actor.sendSystemMessage('Checking AI target ' + latarget.getAttachment('AI').getFollowObject().getTemplate(), 0)
elif command == 'checkaistate':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
if latarget.getAttachment('AI'):
if latarget.getAttachment('AI').getCurrentState():
actor.sendSystemMessage('Checking AI state ' + latarget.getAttachment('AI').getCurrentState().getClass().getName(), 0)
elif command == 'checkairepos':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
if latarget.getAttachment('AI'):
if latarget.getAttachment('AI').getRepositionStartTime()():
actor.sendSystemMessage('Checking AI state ' + latarget.getAttachment('AI').getRepositionStartTime(), 0)
elif command == 'checkaiprog':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
if latarget.getAttachment('AI'):
actor.sendSystemMessage('Checking AI progression %s' % latarget.getAttachment('AI').getProgressionMarker(), 0)
elif command == 'checkwithdrawn':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
if latarget.getAttachment('isWithdrawn'):
actor.sendSystemMessage('Checking AIisWithdrawn %s' % latarget.getAttachment('isWithdrawn'), 0)
elif command == 'showbitmask':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
actor.sendSystemMessage('Optionsbitmask for unit ' + latarget.getCustomName() + ' is %s' % latarget.getOptionsBitmask(), 0)
elif command == 'spawninst':
#String campTemplate = "object/building/poi/shared_gcw_rebel_clone_tent_small.iff"; // LOL why doesn't this spawn?!?!?!
inst = core.objectService.createObject(arg1, 0, actor.getPlanet(), actor.getWorldPosition(), actor.getOrientation())
if inst:
#TangibleObject inst = (TangibleObject) core.objectService.createObject(campTemplate, 0, core.terrainService.getPlanetByName("talus"), new Point3D(-890,9, -2994), quaternion)
core.simulationService.add(inst, inst.getPosition().x, inst.getPosition().z, True)
positionY = core.terrainService.getHeight(inst.getPlanetId(), inst.getPosition().x, inst.getPosition().z)
instpos = Point3D(inst.getPosition().x,positionY+2, inst.getPosition().z)
inst.setPosition(instpos)
elif command == 'los':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
los = core.simulationService.checkLineOfSight(actor, latarget)
if los:
actor.sendSystemMessage('Line of sight between player and target', 0)
else:
actor.sendSystemMessage('NO Line of sight between player and target', 0)
elif command == 'playfx':
effectFile = arg1
cEffMsg = PlayClientEffectLocMessage(effectFile, actor.getPlanet().getName(), actor.getPosition())
actor.getClient().getSession().write(cEffMsg.serialize())
elif command == 'toinvasion':
invasionplanet = core.invasionService.getInvasionPlanetName()
position = Point3D(float(1366), float(13), float(2747))
if invasionplanet == 'talus':
position = Point3D(float(264), float(4), float(-2950))
if invasionplanet == 'tatooine':
position = Point3D(float(-1385), float(12), float(-3597))
core.simulationService.transferToPlanet(actor, core.terrainService.getPlanetByName(invasionplanet), position, actor.getOrientation(), None)
elif command == 'unknownAbilityPacket' and arg1:
packet = UnknownAbilityPacket(arg1)
actor.getClient().getSession().write(packet.serialize())
actor.sendSystemMessage('Sent UnknownAbilityPacket for ability ' + arg1, 0)
return
elif command == 'rank' and arg1:
playerObject.setCurrentRank(int(arg1))
print (playerObject.getCurrentRank())
return
elif command == 'addToFrogAdminList':
frogBuilding = core.objectService.getObject(core.devService.getFrogBuildingId())
if frogBuilding is None:
return
frogBuilding.addPlayerToAdminList(None, actor.getObjectID(), actor.getCustomName().split(' ')[0])
actor.sendSystemMessage('You were added to the Admin list for the Frog Building.', 0)
return
return
+1 -287
View File
@@ -1,287 +1 @@
import sys
from engine.resources.scene import Point3D
from protocol.swg import ObjControllerMessage
from protocol.swg import UnknownAbilityPacket
from protocol.swg import PlayClientEffectLocMessage
from engine.resources.objects import SWGObject
from java.awt.datatransfer import StringSelection
from java.awt.datatransfer import Clipboard
from java.awt import Toolkit
from resources.datatables import GcwRank
from services.gcw import GCWService
def setup():
return
def run(core, actor, target, commandString):
playerObject = actor.getSlottedObject('ghost')
global str
if not playerObject:
return
commandArgs = commandString.split(' ')
command = commandArgs[0]
if len(commandArgs) > 1:
arg1 = commandArgs[1]
if len(commandArgs) > 2:
arg2 = commandArgs[2]
if len(commandArgs) > 3:
arg3 = commandArgs[3]
if len(commandArgs) > 4:
arg4 = commandArgs[4]
if len(commandArgs) > 5:
arg5 = commandArgs[5]
if command == 'giveExperience' and arg1:
core.playerService.giveExperience(actor, int(arg1))
if command == 'level' and arg1:
core.playerService.grantLevel(actor, int(arg1))
elif command == 'setSpeed' and arg1:
#actor.sendSystemMessage("Your speed was " + str(actor.getSpeedMultiplierBase()) + ". Don\'t forget to set this back or it\'ll permanently imbalance your speed. Default without buffs or mods is 1.", 2)
actor.setSpeedMultiplierBase(float(arg1))
actor.sendSystemMessage('Your new speed is ' + arg1 + '.', 2)
elif command == 'teleport' and arg2 and arg3 and arg4:
position = Point3D(float(arg2), float(arg3), float(arg4))
core.simulationService.transferToPlanet(actor, core.terrainService.getPlanetByName(arg1), position, actor.getOrientation(), None)
elif command == 'teleportplayer' and arg1 and arg2 and arg3 and arg4 and arg5:
player = core.chatService.getObjectByFirstName(arg1)
if player:
position = Point3D(float(arg3), float(arg4), float(arg5))
core.simulationService.transferToPlanet(player, core.terrainService.getPlanetByName(arg2), position, player.getOrientation(), None)
elif command == 'credits' and arg1:
actor.setCashCredits(actor.getCashCredits() + int(arg1))
actor.sendSystemMessage('The Galactic Empire has transferred ' + arg1 + ' credits to you for your service.', 0)
elif command == 'addability' and arg1:
actor.addAbility(str(arg1))
actor.sendSystemMessage('You have learned ' + arg1 + '.', 0)
elif command == 'anim' and arg1:
actor.doSkillAnimation(arg1)
actor.sendSystemMessage('Performed ' + arg1 ,0)
elif command == 'changeBio' and arg1:
actor.getSlottedObject('ghost').setBiography(arg1)
elif command == 'spawn' and arg1 and arg2:
pos = actor.getWorldPosition()
core.spawnService.spawnCreature(arg1, actor.getPlanet().getName(), 0, pos.x, pos.y, pos.z, 1, 0, 1, 0, int(arg2))
elif command == 'instance' and arg1:
core.instanceService.queue(arg1, actor)
elif command == 'action' and arg1:
actor.setAction(int(arg1))
elif command == 'health' and arg1:
actor.setHealth(int(arg1))
elif command == 'id':
actor.sendSystemMessage('Your id is: ' + str(actor.getObjectId()), 0)
elif command == 'cust' and arg1 and arg2 and arg3:
obj = core.objectService.getObject(long(arg1))
obj.setCustomizationVariable(str(arg2), int(arg3))
elif command == 'buff' and arg1:
core.buffService.addBuffToCreature(actor, str(arg1), actor)
elif command == 'stealth':
if (actor.isInStealth()):
actor.setInStealth(False)
actor.setRadarVisible(True)
else:
actor.setInStealth(True)
actor.setRadarVisible(False)
elif command == 'holoEmote' and arg1:
playerObject.setHoloEmote('holoemote_' + arg1)
playerObject.setHoloEmoteUses(20)
actor.sendSystemMessage('Holo-Emote Generator set to ' + 'holoemote_' + arg1, 0)
elif command == 'off':
if playerObject.getGodLevel > 0:
actor.removeAbility("admin")
playerObject.setGodLevel(0)
elif command == 'setBounty':
if actor.getFaction() == "":
actor.sendSystemMessage('You must be aligned in order to place a bounty on yourself.', 0)
return
core.playerService.sendSetBountyWindow(actor, actor)
return
elif command == 'genloot':
object = core.lootService.generateLootItem(actor, arg1)
inventory = actor.getSlottedObject('inventory')
if inventory:
inventory.add(object)
elif command == 'spawnobj':
pos = actor.getPosition()
core.staticService.spawnObject(arg1, actor.getPlanet().getName(), 0, pos.x, pos.y, pos.z, 0, 0)
elif command == 'showpos':
pos = actor.getPosition()
ori = actor.getOrientation()
cellid = 0
planetName = actor.getPlanet().getName()
actor.sendSystemMessage('Position.x : %s' % pos.x, 0)
print ('Position.x : %s' % pos.x, 0)
actor.sendSystemMessage('Position.y : %s' % pos.y, 0)
print ('Position.y : %s' % pos.y, 0)
actor.sendSystemMessage('Position.z : %s' % pos.z, 0)
print ('Position.z : %s' % pos.z, 0)
actor.sendSystemMessage('Orientation.w : %s' % ori.w, 0)
print ('Orientation.x : %s' % ori.w, 0)
actor.sendSystemMessage('Orientation.x : %s' % ori.x, 0)
print ('Orientation.w : %s' % ori.x, 0)
actor.sendSystemMessage('Orientation.y : %s' % ori.y, 0)
print ('Orientation.y : %s' % ori.y, 0)
actor.sendSystemMessage('Orientation.z : %s' % ori.z, 0)
print ('Orientation.z : %s' % ori.z, 0)
if (actor.getContainer()):
building_id = actor.getGrandparent().getObjectID()
cid = actor.getContainer().getCellNumber()
cellid = cid
actor.sendSystemMessage('Cell ID : %s' % cid, 0)
actor.sendSystemMessage('Building ID : %s' % building_id, 0)
print('Cell ID : %s' % cid, 0)
print('Building ID : %s' % building_id, 0)
if cellid == 0:
str = "<OBJECTNAME> = stcSvc.spawnObject('<MOBILENAME>', '" + planetName + "', long(%s" % cellid + "), float(%.4f" % pos.x + "), float(%.4f" % pos.y + "), float(%.4f" % pos.z + "), float(%.4f" % ori.w + "), float(%.4f" % ori.x + "), float(%.4f" % ori.y + "), float(%.4f" % ori.z + "))"
elif cellid != 0:
str = "\tbuilding = core.objectService.getObject(long(%s" % building_id + "))\n\t<OBJECTNAME> = stcSvc.spawnObject('<MOBILENAME>', '" + planetName + "', building.getCellByCellNumber(long(%s" % cellid + ")), float(%.4f" % pos.x + "), float(%.4f" % pos.y + "), float(%.4f" % pos.z + "), float(%.4f" % ori.w + "), float(%.4f" % ori.x + "), float(%.4f" % ori.y + "), float(%.4f" % ori.z + "))"
toolkit = Toolkit.getDefaultToolkit()
clipboard = toolkit.getSystemClipboard()
clipboard.setContents(StringSelection(str), None)
elif command == 'patrolpoint':
pos = actor.getPosition()
str = "patrolpoints.add(Point3D(float(%.2f" % pos.x + "), float(%.2f" % pos.y + "), float(%.2f" % pos.z + ")))"
toolkit = Toolkit.getDefaultToolkit()
clipboard = toolkit.getSystemClipboard()
clipboard.setContents(StringSelection(str), None)
actor.sendSystemMessage('Patrolpoint copied to clipboard', 0)
elif command == 'jesus':
actor.setHealth(actor.getMaxHealth())
actor.setAction(actor.getMaxAction())
actor.setPosture(0)
actor.setSpeedMultiplierBase(1)
actor.setTurnRadius(1)
elif command == 'checkai':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
actor.sendSystemMessage('Checking AI handling for unit ' + latarget.getCustomName(), 0)
core.aiService.setCheckAI(latarget)
elif command == 'checkaitarget':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
if latarget.getAttachment('AI'):
if latarget.getAttachment('AI').getFollowObject():
actor.sendSystemMessage('Checking AI target ' + latarget.getAttachment('AI').getFollowObject().getTemplate(), 0)
elif command == 'checkaistate':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
if latarget.getAttachment('AI'):
if latarget.getAttachment('AI').getCurrentState():
actor.sendSystemMessage('Checking AI state ' + latarget.getAttachment('AI').getCurrentState().getClass().getName(), 0)
elif command == 'checkairepos':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
if latarget.getAttachment('AI'):
if latarget.getAttachment('AI').getRepositionStartTime()():
actor.sendSystemMessage('Checking AI state ' + latarget.getAttachment('AI').getRepositionStartTime(), 0)
elif command == 'checkaiprog':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
if latarget.getAttachment('AI'):
actor.sendSystemMessage('Checking AI progression %s' % latarget.getAttachment('AI').getProgressionMarker(), 0)
elif command == 'checkwithdrawn':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
if latarget.getAttachment('isWithdrawn'):
actor.sendSystemMessage('Checking AIisWithdrawn %s' % latarget.getAttachment('isWithdrawn'), 0)
elif command == 'showbitmask':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
actor.sendSystemMessage('Optionsbitmask for unit ' + latarget.getCustomName() + ' is %s' % latarget.getOptionsBitmask(), 0)
elif command == 'spawninst':
#String campTemplate = "object/building/poi/shared_gcw_rebel_clone_tent_small.iff"; // LOL why doesn't this spawn?!?!?!
inst = core.objectService.createObject(arg1, 0, actor.getPlanet(), actor.getWorldPosition(), actor.getOrientation())
if inst:
#TangibleObject inst = (TangibleObject) core.objectService.createObject(campTemplate, 0, core.terrainService.getPlanetByName("talus"), new Point3D(-890,9, -2994), quaternion)
core.simulationService.add(inst, inst.getPosition().x, inst.getPosition().z, True)
positionY = core.terrainService.getHeight(inst.getPlanetId(), inst.getPosition().x, inst.getPosition().z)
instpos = Point3D(inst.getPosition().x,positionY+2, inst.getPosition().z)
inst.setPosition(instpos)
elif command == 'los':
latargetID = long(actor.getIntendedTarget())
latarget = core.objectService.getObject(latargetID)
los = core.simulationService.checkLineOfSight(actor, latarget)
if los:
actor.sendSystemMessage('Line of sight between player and target', 0)
else:
actor.sendSystemMessage('NO Line of sight between player and target', 0)
elif command == 'playfx':
effectFile = arg1
cEffMsg = PlayClientEffectLocMessage(effectFile, actor.getPlanet().getName(), actor.getPosition())
actor.getClient().getSession().write(cEffMsg.serialize())
elif command == 'toinvasion':
invasionplanet = core.invasionService.getInvasionPlanetName()
position = Point3D(float(1366), float(13), float(2747))
if invasionplanet == 'talus':
position = Point3D(float(264), float(4), float(-2950))
if invasionplanet == 'tatooine':
position = Point3D(float(-1385), float(12), float(-3597))
core.simulationService.transferToPlanet(actor, core.terrainService.getPlanetByName(invasionplanet), position, actor.getOrientation(), None)
elif command == 'unknownAbilityPacket' and arg1:
packet = UnknownAbilityPacket(arg1)
actor.getClient().getSession().write(packet.serialize())
actor.sendSystemMessage('Sent UnknownAbilityPacket for ability ' + arg1, 0)
return
elif command == 'rank' and arg1:
playerObject.setCurrentRank(int(arg1))
print (playerObject.getCurrentRank())
return
elif command == 'addToFrogAdminList':
frogBuilding = core.objectService.getObject(core.devService.getFrogBuildingId())
if frogBuilding is None:
return
frogBuilding.addPlayerToAdminList(None, actor.getObjectID(), actor.getCustomName().split(' ')[0])
actor.sendSystemMessage('You were added to the Admin list for the Frog Building.', 0)
return
return
# This file will be updated at a later date with a new command.
+31
View File
@@ -0,0 +1,31 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package resources.datatables;
public class AdminTag {
public static final byte NONE = 0; // Default
public static final byte CSR = 1; // (CSR)
public static final byte DEVELOPER = 2; // (Developer)
public static final byte WARDEN = 3; // (Warden)
public static final byte QA = 4; // (QA)
}
@@ -33,6 +33,7 @@ import java.util.concurrent.TimeUnit;
import org.apache.mina.core.buffer.IoBuffer;
import resources.craft.DraftSchematic;
import resources.datatables.AdminTag;
import resources.datatables.Citizenship;
import resources.datatables.Professions;
import resources.gcw.RegionDefender;
@@ -130,7 +131,7 @@ public class PlayerObject extends IntangibleObject implements Serializable {
@Override
public Baseline getBaseline6() {
Baseline baseline = super.getBaseline6();
baseline.put("godLevel", (byte) 0);
baseline.put("adminTag", (byte) AdminTag.NONE);
baseline.put("currentRank", 0);
baseline.put("rankProgress", (float) 0);
baseline.put("highestRebelRank", 0);
@@ -435,12 +436,12 @@ public class PlayerObject extends IntangibleObject implements Serializable {
notifyClients(getBaseline(3).set("showBackpack", showBackpack), true);
}
public byte getGodLevel() {
return (byte) getBaseline(6).get("godLevel");
public byte getAdminTagValue() {
return (byte) getBaseline(6).get("adminTag");
}
public void setGodLevel(int godLevel) {
notifyClients(getBaseline(6).set("godLevel", (byte) godLevel), true);
public void setAdminTagValue(byte adminTag) {
notifyClients(getBaseline(6).set("adminTag", (byte) adminTag), true);
}
public int getCurrentRank() {
+11 -10
View File
@@ -105,8 +105,9 @@ public class LoginService implements INetworkDispatch{
String user = clientID.getAccountName();
String pass = clientID.getPassword();
String version = clientID.getVersion();
int id = LoginProvider.getAccountId(user, pass, session.getRemoteAddress().toString());
System.out.println("LOGIN: " + user + " login attempt "+session.getRemoteAddress().toString()+" returned " + id);
System.out.println("LOGIN: " + user + " login attempt " + session.getRemoteAddress().toString() + " returned " + id);
if (id < 0) {
@@ -135,6 +136,15 @@ public class LoginService implements INetworkDispatch{
return;
}
if(!version.equals("20111130-15:46")) {
ErrorMessage clientErr = new ErrorMessage("Invalid Client", "The version of your client is invalid.");
session.write(clientErr.serialize());
Disconnect disconnect = new Disconnect((Integer)session.getAttribute("connectionId"), 6);
session.write(disconnect);
return;
}
Client client = new Client(session.getRemoteAddress());
client.setAccountName(user);
client.setPassword(pass);
@@ -370,14 +380,5 @@ public class LoginService implements INetworkDispatch{
return clusterStatus;
}
/**
* 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;
}
}
+3 -2
View File
@@ -75,6 +75,7 @@ import resources.datatables.GcwRank;
import resources.datatables.Options;
import resources.datatables.PlayerFlags;
import resources.datatables.Professions;
import resources.datatables.AdminTag;
import resources.guild.Guild;
import resources.objects.building.BuildingObject;
import resources.objects.cell.CellObject;
@@ -190,7 +191,7 @@ public class PlayerService implements INetworkDispatch {
scheduleList.add(scheduler.scheduleAtFixedRate(() -> {
try {
if (creature.isInStealth() && !creature.getOption(Options.INVULNERABLE) && ((PlayerObject) creature.getSlottedObject("ghost")).getGodLevel() == 0) {
if (creature.isInStealth() && !creature.getOption(Options.INVULNERABLE) && core.adminService.getAccessLevelFromDB(creature.getClient().getAccountId()) == null) {
List<SWGObject> objects = core.simulationService.get(creature.getPlanet(), creature.getPosition().x, creature.getPosition().z, 64);
for (SWGObject object : objects) {
@@ -204,7 +205,7 @@ public class PlayerService implements INetworkDispatch {
CreatureObject observer = (CreatureObject) object;
int camoflauge = creature.getSkillModBase("camoflauge") - observer.getSkillModBase("detectcamo");
int camoflauge = creature.getSkillModBase("camouflage") - observer.getSkillModBase("detectcamo");
camoflauge -= (64 - creature.getPosition().getDistance(observer.getPosition()));
if (new Random(camoflauge).nextInt() == camoflauge) {