mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-16 06:13:45 -04:00
Added ChangeRoleIcon (gold icons), fixed titles
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
/*******************************************************************************
|
||||
* 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 protocol.swg.objectControllerObjects;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
public class ChangeRoleIconChoice extends ObjControllerObject {
|
||||
|
||||
private long objectId = 0;
|
||||
private int icon = 0;
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(IoBuffer buffer) {
|
||||
buffer.flip().order(ByteOrder.LITTLE_ENDIAN);
|
||||
objectId = buffer.getLong();
|
||||
buffer.skip(4);
|
||||
icon = buffer.getInt();
|
||||
}
|
||||
|
||||
public long getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
public int getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,5 +32,6 @@ public class ObjControllerOpcodes {
|
||||
public static final int SECURE_TRADE = 0x15010000;
|
||||
public static final int BUFF_BUILDER_CHANGE = 0x5A020000;
|
||||
public static final int MISSION_LIST_REQUEST = 0xF5000000;
|
||||
public static final int ChangeRoleIconChoice = 0x4D040000;
|
||||
|
||||
}
|
||||
|
||||
@@ -34,16 +34,6 @@ 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);
|
||||
}
|
||||
@@ -84,7 +74,7 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
buffer.putInt(player.getTotalPlayTime()); // total play time?
|
||||
|
||||
buffer.putInt(getProfData(player.getProfession())); // prof icon
|
||||
buffer.putInt(player.getProfessionIcon());
|
||||
|
||||
buffer.put(getAsciiString(player.getProfession()));
|
||||
buffer.putInt(0); // GCW
|
||||
@@ -350,6 +340,15 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer buildProfessionIconDelta(int professionIcon) {
|
||||
IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putInt(professionIcon);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("PLAY", (byte) 3, (short) 1, (short) 0x0A, buffer, size + 4);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildCollectionsDelta(byte[] collections, int highestSetBit) {
|
||||
IoBuffer buffer = bufferPool.allocate(8 + collections.length, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putInt(collections.length);
|
||||
@@ -599,32 +598,6 @@ public class PlayerMessageBuilder extends ObjectMessageBuilder {
|
||||
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 sendListDelta(byte viewType, short updateType, IoBuffer buffer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@@ -41,13 +41,14 @@ import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
@Persistent(version=1)
|
||||
@Persistent(version=2)
|
||||
public class PlayerObject extends SWGObject {
|
||||
|
||||
// PLAY 3
|
||||
|
||||
private String title;
|
||||
private String profession;
|
||||
private int professionIcon;
|
||||
private List<Integer> flagsList = new ArrayList<Integer>();
|
||||
private List<Integer> profileList = new ArrayList<Integer>();
|
||||
private List<String> titleList = new ArrayList<String>();
|
||||
@@ -146,7 +147,9 @@ public class PlayerObject extends SWGObject {
|
||||
|
||||
}
|
||||
|
||||
notifyObservers(messageBuilder.buildTitleDelta(title), true);
|
||||
if (getContainer() != null) {
|
||||
getContainer().notifyObservers(messageBuilder.buildTitleDelta(title), true);
|
||||
}
|
||||
}
|
||||
|
||||
public String getProfession() {
|
||||
@@ -639,4 +642,43 @@ public class PlayerObject extends SWGObject {
|
||||
}
|
||||
}
|
||||
|
||||
public int getProfessionIcon() {
|
||||
synchronized(objectMutex) {
|
||||
return professionIcon;
|
||||
}
|
||||
}
|
||||
|
||||
public void setProfessionIcon(int professionIcon) {
|
||||
synchronized(objectMutex) {
|
||||
this.professionIcon = professionIcon;
|
||||
}
|
||||
|
||||
if (getContainer() != null) {
|
||||
getContainer().notifyObservers(messageBuilder.buildProfessionIconDelta(professionIcon), true);
|
||||
}
|
||||
}
|
||||
|
||||
public int getProfData(String profession) {
|
||||
switch (profession) {
|
||||
case "spy_1a":
|
||||
return 0x23;
|
||||
case "smuggler_1a":
|
||||
return 0x19;
|
||||
case "officer_1a":
|
||||
return 0x0F;
|
||||
case "force_sensitive_1a":
|
||||
return 0x28;
|
||||
case "commando_1a":
|
||||
return 0x1E;
|
||||
case "entertainer_1a":
|
||||
return 0x05;
|
||||
case "medic_1a":
|
||||
return 0x0A;
|
||||
case "bounty_hunter_1a":
|
||||
return 0x14;
|
||||
default:
|
||||
return 0x00;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -251,6 +251,7 @@ public class CharacterService implements INetworkDispatch {
|
||||
object._add(player);
|
||||
core.skillService.addSkill(object, "species_" + object.getStfName());
|
||||
player.setProfession(clientCreateCharacter.getProfession());
|
||||
player.setProfessionIcon(player.getProfData(clientCreateCharacter.getProfession()));
|
||||
player.setProfessionWheelPosition(clientCreateCharacter.getProfessionWheelPosition());
|
||||
if(clientCreateCharacter.getHairObject().length() > 0) {
|
||||
String sharedHairTemplate = clientCreateCharacter.getHairObject().replace("/hair_", "/shared_hair_");
|
||||
|
||||
@@ -41,9 +41,11 @@ import protocol.swg.ClientIdMsg;
|
||||
import protocol.swg.ClientMfdStatusUpdateMessage;
|
||||
import protocol.swg.ExpertiseRequestMessage;
|
||||
import protocol.swg.ServerTimeMessage;
|
||||
import protocol.swg.objectControllerObjects.ChangeRoleIconChoice;
|
||||
import protocol.swg.objectControllerObjects.ShowFlyText;
|
||||
import resources.common.Console;
|
||||
import resources.common.FileUtilities;
|
||||
import resources.common.ObjControllerOpcodes;
|
||||
import resources.common.Opcodes;
|
||||
import resources.common.RGB;
|
||||
import resources.common.SpawnPoint;
|
||||
@@ -149,6 +151,31 @@ public class PlayerService implements INetworkDispatch {
|
||||
@Override
|
||||
public void insertOpcodes(Map<Integer, INetworkRemoteEvent> swgOpcodes, Map<Integer, INetworkRemoteEvent> objControllerOpcodes) {
|
||||
|
||||
objControllerOpcodes.put(ObjControllerOpcodes.ChangeRoleIconChoice, new INetworkRemoteEvent() {
|
||||
|
||||
@Override
|
||||
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
|
||||
Client c = core.getClient((Integer) session.getAttribute("connectionId"));
|
||||
ChangeRoleIconChoice packet = new ChangeRoleIconChoice();
|
||||
PlayerObject player;
|
||||
SWGObject o;
|
||||
|
||||
packet.deserialize(data);
|
||||
o = core.objectService.getObject(packet.getObjectId());
|
||||
|
||||
if (c.getParent() == null || o == null || c.getParent() != o
|
||||
|| !(o instanceof CreatureObject) || !(o.getSlottedObject("ghost")
|
||||
instanceof PlayerObject)) {
|
||||
return;
|
||||
}
|
||||
|
||||
player = (PlayerObject) o.getSlottedObject("ghost");
|
||||
|
||||
player.setProfessionIcon(packet.getIcon());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
swgOpcodes.put(Opcodes.CmdSceneReady, new INetworkRemoteEvent() {
|
||||
|
||||
@Override
|
||||
@@ -189,7 +216,6 @@ public class PlayerService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
});*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -499,7 +525,6 @@ public class PlayerService implements INetworkDispatch {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
Reference in New Issue
Block a user