mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-31 01:15:57 -04:00
Merge branch 'master' of https://github.com/ProjectSWGCore/NGECore2
Conflicts: src/resources/objects/tangible/TangibleObject.java
This commit is contained in:
@@ -4,17 +4,18 @@ def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
canEquip = core.equipmentService.canEquip(actor, target)
|
||||
|
||||
if canEquip[0] is False:
|
||||
actor.sendSystemMessage(canEquip[1], 0)
|
||||
return
|
||||
|
||||
|
||||
parsedMsg = commandString.split(' ', 3)
|
||||
objService = core.objectService
|
||||
containerID = long(parsedMsg[1])
|
||||
container = objService.getObject(containerID)
|
||||
|
||||
canEquip = core.equipmentService.canEquip(actor, target)
|
||||
|
||||
if canEquip[0] is False and container == actor:
|
||||
actor.sendSystemMessage(canEquip[1], 0)
|
||||
return
|
||||
|
||||
if target and container and target.getContainer():
|
||||
oldContainer = target.getContainer()
|
||||
if container == oldContainer:
|
||||
|
||||
@@ -45,7 +45,7 @@ def run(core, actor, target, commandString):
|
||||
|
||||
canEquip = core.equipmentService.canEquip(actor, target)
|
||||
|
||||
if canEquip[0] is False:
|
||||
if canEquip[0] is False and container == actor:
|
||||
actor.sendSystemMessage(canEquip[1], 0)
|
||||
return
|
||||
|
||||
|
||||
@@ -4,11 +4,7 @@ def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
canEquip = core.equipmentService.canEquip(actor, target)
|
||||
|
||||
if canEquip[0] is False:
|
||||
actor.sendSystemMessage(canEquip[1], 0)
|
||||
return
|
||||
|
||||
|
||||
|
||||
parsedMsg = commandString.split(' ', 3)
|
||||
@@ -21,6 +17,12 @@ def run(core, actor, target, commandString):
|
||||
print 'Error: New container is same as old container.'
|
||||
return;
|
||||
|
||||
canEquip = core.equipmentService.canEquip(actor, target)
|
||||
|
||||
if canEquip[0] is False and container == actor:
|
||||
actor.sendSystemMessage(canEquip[1], 0)
|
||||
return
|
||||
|
||||
replacedObject = None
|
||||
slotName = None
|
||||
replacedObjects = []
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package resources.datatables;
|
||||
|
||||
import engine.clientdata.StfTable;
|
||||
|
||||
public class STF
|
||||
{
|
||||
/*
|
||||
Returns a string containing the value of a key in the SWG STF path;
|
||||
Example: get("@cmd_err:success_prose") returns "The command %TO was a success."
|
||||
*/
|
||||
static public String get(String stfPath)
|
||||
{
|
||||
stfPath = stfPath.replace("@", "");
|
||||
String stfFile = stfPath.split(":")[0];
|
||||
String stfKey = stfPath.split(":")[1];
|
||||
|
||||
try
|
||||
{
|
||||
StfTable stf = new StfTable("clientdata/string/en/" + stfFile + ".stf");
|
||||
for (int s = 1; s < stf.getRowCount(); s++)
|
||||
{
|
||||
if(stf.getStringById(s).getKey() != null && stf.getStringById(s).getKey().equals(stfKey)) return stf.getStringById(s).getValue();
|
||||
}
|
||||
}
|
||||
catch (Exception e) { }
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,7 @@ import protocol.swg.objectControllerObjects.ShowFlyText;
|
||||
import resources.common.OutOfBand;
|
||||
import resources.datatables.Options;
|
||||
import resources.datatables.PvpStatus;
|
||||
import resources.datatables.STF;
|
||||
import resources.loot.LootGroup;
|
||||
import resources.objects.ObjectMessageBuilder;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
@@ -129,8 +130,10 @@ public class TangibleObject extends SWGObject implements Serializable {
|
||||
messageBuilder = new TangibleMessageBuilder(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setCustomName2(String customName) {
|
||||
setCustomName(customName);
|
||||
System.err.println("setCustomName2 is now deprecated - please use setCustomName");
|
||||
}
|
||||
|
||||
public int getIncapTimer() {
|
||||
@@ -641,8 +644,10 @@ public class TangibleObject extends SWGObject implements Serializable {
|
||||
{
|
||||
if(getTemplateData().getAttribute("containerVolumeLimit") == null) return false;
|
||||
|
||||
int containerVolumeLimit = getTemplateData().getAttribute("containerVolumeLimit");
|
||||
int containerVolumeLimit = (int)getTemplateData().getAttribute("containerVolumeLimit") >> 8; // Shifting because it seems to be returning an extra byte before it should
|
||||
|
||||
if(containerVolumeLimit == 0) return false;
|
||||
|
||||
if(NGECore.getInstance().objectService.objsInContainer(this, this) >= containerVolumeLimit) return true;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -573,12 +573,33 @@ public class PlayerService implements INetworkDispatch {
|
||||
return;
|
||||
}
|
||||
|
||||
player.setProfession(profession);
|
||||
|
||||
String xpType = ((profession.contains("entertainer")) ? "entertainer" : ((profession.contains("trader")) ? "crafting" : "combat_general"));
|
||||
|
||||
int experience = player.getXp(xpType);
|
||||
|
||||
// Remove old profession abilties - resetLevel wont due because resetLevel grants basic specials for level 1
|
||||
try
|
||||
{
|
||||
String[] skills;
|
||||
|
||||
DatatableVisitor skillTemplate = ClientFileManager.loadFile("datatables/skill_template/skill_template.iff", DatatableVisitor.class);
|
||||
|
||||
for (int s = 0; s < skillTemplate.getRowCount(); s++)
|
||||
{
|
||||
if (skillTemplate.getObject(s, 0) != null) {
|
||||
if (((String) skillTemplate.getObject(s, 0)).equals(player.getProfession()))
|
||||
{
|
||||
skills = ((String) skillTemplate.getObject(s, 4)).split(",");
|
||||
for (String skill : skills) core.skillService.removeSkill(creature, skill);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); }
|
||||
core.skillService.resetExpertise(creature);
|
||||
|
||||
player.setProfession(profession);
|
||||
|
||||
try {
|
||||
experienceTable = ClientFileManager.loadFile("datatables/player/player_level.iff", DatatableVisitor.class);
|
||||
|
||||
|
||||
@@ -766,8 +766,6 @@ public class SimulationService implements INetworkDispatch {
|
||||
if(object.getAttachment("proposer") != null)
|
||||
object.setAttachment("proposer", null);
|
||||
|
||||
object.setPvPBitmask(0);
|
||||
|
||||
//session.suspendWrite();
|
||||
final long objectId = object.getObjectID();
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.python.core.PyObject;
|
||||
import resources.common.FileUtilities;
|
||||
import resources.common.OutOfBand;
|
||||
import resources.datatables.DisplayType;
|
||||
import resources.datatables.STF;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import main.NGECore;
|
||||
@@ -310,16 +311,16 @@ public class CollectionService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
if (hidden && !(getCollection(creature, collectionName) > 0)) {
|
||||
creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_hidden_slot_added", "TO", "@collection_n:" + collectionName), DisplayType.Broadcast);
|
||||
creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_hidden_slot_added", "TO", STF.get("@collection_n:" + collectionName).replace(":", " -")), DisplayType.Broadcast);
|
||||
}
|
||||
|
||||
player.setCollections(collections.toByteArray());
|
||||
|
||||
if (!noMessage) {
|
||||
if (!bookName.equals("crafting_book")) {
|
||||
creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_slot_added", "TU", "@collection_n:" + slotName, "TO", "@collection_n:" + collectionName), DisplayType.Broadcast);
|
||||
creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_slot_added", "TU", STF.get("@collection_n:" + slotName).replace(":", " -"), "TO", STF.get("@collection_n:" + collectionName).replace(":", " -")), DisplayType.Broadcast);
|
||||
} else {
|
||||
creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_slot_increment", "TU", "@collection_n:" + slotName, "TO", "@collection_n:" + collectionName), DisplayType.Broadcast);
|
||||
creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_slot_increment", "TU", STF.get("@collection_n:" + slotName).replace(":", " -"), "TO", STF.get("@collection_n:" + collectionName).replace(":", " -")), DisplayType.Broadcast);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,7 +357,7 @@ public class CollectionService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
if (isComplete(creature, collectionName)) {
|
||||
creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_collection_complete", "TO", "@collection_n:" + collectionName), DisplayType.Broadcast);
|
||||
creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_collection_complete", "TO", STF.get("@collection_n:" + collectionName).replace(":", " -")), DisplayType.Broadcast);
|
||||
|
||||
if (!noReward) {
|
||||
try {
|
||||
@@ -445,7 +446,7 @@ public class CollectionService implements INetworkDispatch {
|
||||
if (trackServerFirst) {
|
||||
if (core.guildService.getGuildObject().addServerFirst(collectionName, new ServerFirst(creature.getCustomName(), creature.getObjectId(), collectionName, System.currentTimeMillis()))) {
|
||||
addCollection(creature, "bdg_server_first_01");
|
||||
creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_server_first", "TT", core.getGalaxyName(), "TO", "@collection_n:" + collectionName), DisplayType.Broadcast);
|
||||
creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_server_first", "TT", core.getGalaxyName(), "TO", STF.get("@collection_n:" + collectionName).replace(":", " -")), DisplayType.Broadcast);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -818,7 +819,7 @@ public class CollectionService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
if (collection.equals(collectionName)) {
|
||||
creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_collection_reset", "TO", "@collection_n:" + collectionName), DisplayType.Broadcast);
|
||||
creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_collection_reset", "TO", STF.get("@collection_n:" + collectionName).replace(":", " -")), DisplayType.Broadcast);
|
||||
}
|
||||
|
||||
continue;
|
||||
|
||||
@@ -121,6 +121,7 @@ import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.tool.SurveyTool;
|
||||
import resources.objects.waypoint.WaypointObject;
|
||||
import resources.objects.weapon.WeaponObject;
|
||||
import services.EquipmentService;
|
||||
import services.ai.AIActor;
|
||||
import services.command.BaseSWGCommand;
|
||||
import services.command.CombatCommand;
|
||||
@@ -457,7 +458,7 @@ public class ObjectService implements INetworkDispatch {
|
||||
return;
|
||||
}
|
||||
|
||||
if (object.getAttachment("AI") != null && ((AIActor) object.getAttachment("AI")).getMobileTemplate().getRespawnTime() > 0) {
|
||||
if (object.getAttachment("AI") != null && object.getAttachment("AI") instanceof AIActor && ((AIActor) object.getAttachment("AI")).getMobileTemplate().getRespawnTime() > 0) {
|
||||
final long objectId = object.getObjectID();
|
||||
final String Template = object.getTemplate();
|
||||
final Planet planet = object.getPlanet();
|
||||
@@ -501,6 +502,8 @@ public class ObjectService implements INetworkDispatch {
|
||||
|
||||
if(parent != null) {
|
||||
if(parent instanceof CreatureObject) {
|
||||
core.equipmentService.unequip((CreatureObject) parent, object);
|
||||
|
||||
((CreatureObject) parent).removeObjectFromEquipList(object);
|
||||
((CreatureObject) parent).removeObjectFromAppearanceEquipList(object);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user