mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-08-27 17:57:22 -04:00
Merge branch 'master' of https://github.com/ProjectSWGCore/NGECore2
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
from resources.common import PlayerFlags
|
||||
import sys
|
||||
|
||||
def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
ghost = actor.getSlottedObject('ghost')
|
||||
print ('Command recieved!')
|
||||
ghost.toggleFlag(PlayerFlags.LFG)
|
||||
return
|
||||
@@ -0,0 +1,10 @@
|
||||
from resources.common import PlayerFlags
|
||||
import sys
|
||||
|
||||
def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
ghost = actor.getSlottedObject('ghost')
|
||||
ghost.toggleFlag(PlayerFlags.HELPER)
|
||||
return
|
||||
@@ -0,0 +1,11 @@
|
||||
from java.lang import Integer
|
||||
from resources.common import PlayerFlags
|
||||
import sys
|
||||
|
||||
def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
ghost = actor.getSlottedObject('ghost')
|
||||
ghost.toggleFlag(PlayerFlags.ROLEPLAYER)
|
||||
return
|
||||
@@ -6,8 +6,8 @@ def setup():
|
||||
def run(core, actor, target, commandString):
|
||||
|
||||
playerObject = actor.getSlottedObject('ghost')
|
||||
print ("Title set to: " + commandString)
|
||||
print ("List of Titles: " + playerObject.getTitleList().toString())
|
||||
#print ("Title set to: " + commandString)
|
||||
#print ("List of Titles: " + playerObject.getTitleList().toString())
|
||||
if playerObject is None:
|
||||
return
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
from resources.common import PlayerFlags
|
||||
import sys
|
||||
|
||||
def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
ghost = actor.getSlottedObject('ghost')
|
||||
ghost.toggleFlag(PlayerFlags.AFK)
|
||||
return
|
||||
@@ -0,0 +1,32 @@
|
||||
/*******************************************************************************
|
||||
* 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.common;
|
||||
|
||||
public class PlayerFlags {
|
||||
public static final int LFG = 0x01;
|
||||
public static final int HELPER = 0x02;
|
||||
public static final int ROLEPLAYER = 0x04;
|
||||
public static final int AFK = 0x80;
|
||||
public static final int LD = 0x0100;
|
||||
public static final int FACTIONRANK = 0x0200;
|
||||
|
||||
}
|
||||
@@ -598,6 +598,21 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildFlagBitmask(int bitmask) {
|
||||
IoBuffer buffer = bufferPool.allocate(30, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putInt(4);
|
||||
buffer.putInt(bitmask);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
|
||||
buffer = createDelta("PLAY", (byte) 3, (short) 1, (short) 5, buffer, size + 4);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@@ -56,6 +56,7 @@ public class PlayerObject extends IntangibleObject {
|
||||
private int totalPlayTime = 0;
|
||||
private byte[] collections = new byte[] { };
|
||||
private int highestSetBit = 0;
|
||||
private int flagBitmask = 0;
|
||||
|
||||
// PLAY 6
|
||||
|
||||
@@ -658,4 +659,38 @@ public class PlayerObject extends IntangibleObject {
|
||||
}
|
||||
}
|
||||
|
||||
public int getFlagBitmask() {
|
||||
synchronized(objectMutex) {
|
||||
return flagBitmask;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFlagBitmask(int flagBitmask) {
|
||||
synchronized(objectMutex) {
|
||||
this.flagBitmask |= flagBitmask;
|
||||
}
|
||||
|
||||
if (getContainer() != null) {
|
||||
getContainer().notifyObservers(messageBuilder.buildFlagBitmask(this.flagBitmask), true);
|
||||
}
|
||||
}
|
||||
public void clearFlagBitmask(int flagBitmask) {
|
||||
synchronized(objectMutex) {
|
||||
// set flag bitmask to 0
|
||||
this.flagBitmask &= ~flagBitmask;
|
||||
}
|
||||
|
||||
if (getContainer() != null) {
|
||||
getContainer().notifyObservers(messageBuilder.buildFlagBitmask(this.flagBitmask), true);
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleFlag(int flag) {
|
||||
if ((this.flagBitmask & flag) == flag) {
|
||||
clearFlagBitmask(flag);
|
||||
} else {
|
||||
setFlagBitmask(flag);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user