mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-03 18:13:11 -04:00
Binary file not shown.
@@ -12,9 +12,12 @@ def run(core, actor, target, commandString):
|
||||
#if actor.getSkills('Foraging')==0:
|
||||
#actor.sendSystemMessage('@skl_use:sys_forage_noskill'),0)
|
||||
|
||||
#if actor.isForaging()==1:
|
||||
#actor.sendSystemMessage('@skl_use:sys_forage_already',0)
|
||||
#return
|
||||
if actor.getAttachment("LastForageTime"):
|
||||
if actor.getAttachment("LastForageTime")>int(round(time.time() * 1000))-5000:
|
||||
actor.sendSystemMessage('@skl_use:sys_forage_already',0)
|
||||
return
|
||||
|
||||
actor.setAttachment("LastForageTime",int(round(time.time() * 1000)))
|
||||
|
||||
if actor.getCombatFlag()!=0:
|
||||
actor.sendSystemMessage('@skl_use:sys_forage_combatfail',0)
|
||||
|
||||
@@ -13,13 +13,13 @@ def addTemplate(core):
|
||||
mobileTemplate.setCreatureName('forage_goon')
|
||||
mobileTemplate.setLevel(1)
|
||||
mobileTemplate.setDifficulty(Difficulty.ELITE)
|
||||
|
||||
mobileTemplate.setMinSpawnDistance(4)
|
||||
mobileTemplate.setMaxSpawnDistance(8)
|
||||
mobileTemplate.setDeathblow(False)
|
||||
mobileTemplate.setDeathblow(True)
|
||||
mobileTemplate.setScale(1)
|
||||
mobileTemplate.setAssistRange(12)
|
||||
mobileTemplate.setStalker(False)
|
||||
mobileTemplate.setSocialGroup("tusken raider")
|
||||
mobileTemplate.setOptionsBitmask(Options.AGGRESSIVE | Options.ATTACKABLE)
|
||||
|
||||
templates = Vector()
|
||||
@@ -33,16 +33,16 @@ def addTemplate(core):
|
||||
mobileTemplate.setTemplates(templates)
|
||||
|
||||
weaponTemplates = Vector()
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_dh17.iff', WeaponType.CARBINE, 0.6, 15, 'kinetic')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/pistol/shared_pistol_dl44.iff', WeaponType.PISTOL, 0.4, 15, 'kinetic')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/rifle/shared_rifle_dlt20a.iff', WeaponType.RIFLE, 0.8, 24, 'kinetic')
|
||||
#weapontemplate = WeaponTemplate('object/weapon/ranged/carbine/shared_carbine_dh17.iff', WeaponType.CARBINE, 0.6, 15, 'kinetic')
|
||||
#weaponTemplates.add(weapontemplate)
|
||||
#weapontemplate = WeaponTemplate('object/weapon/ranged/pistol/shared_pistol_dl44.iff', WeaponType.PISTOL, 0.4, 15, 'kinetic')
|
||||
#weaponTemplates.add(weapontemplate)
|
||||
weapontemplate = WeaponTemplate('object/weapon/ranged/rifle/shared_rifle_dlt20a.iff', WeaponType.RIFLE, 1.0, 24, 'kinetic')
|
||||
weaponTemplates.add(weapontemplate)
|
||||
mobileTemplate.setWeaponTemplateVector(weaponTemplates)
|
||||
|
||||
attacks = Vector()
|
||||
mobileTemplate.setDefaultAttack('rangedShot')
|
||||
mobileTemplate.setDefaultAttack('rangedShotrifle')
|
||||
mobileTemplate.setAttacks(attacks)
|
||||
|
||||
core.spawnService.addMobileTemplate('forage_goon', mobileTemplate)
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
package protocol.swg;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import main.NGECore;
|
||||
|
||||
@@ -78,7 +78,8 @@ public class ObjControllerMessage extends SWGMessage {
|
||||
public static final int RESOURCE_WEIGHTS = 0x0207;
|
||||
public static final int MISSION_ACCEPT_RESPONSE = 0x00FA;
|
||||
public static final int MISSION_ABORT_RESPONSE = 0x0142;
|
||||
public static final int QUEST_TASK_TIMER_MESSAGE = 0x0441;
|
||||
public static final int QUEST_TASK_COUNTER = 0x0441;
|
||||
public static final int QUEST_TASK_TIMER = 0x0444;
|
||||
public static final int FORCE_ACTIVATE_QUEST = 0x04BE;
|
||||
|
||||
public ObjControllerMessage() {
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
|
||||
public class QuestTaskCounterMessage extends ObjControllerObject {
|
||||
|
||||
private long objectId;
|
||||
private String questName;
|
||||
private String stf;
|
||||
|
||||
public QuestTaskCounterMessage(long objectId, String questName, String stf) {
|
||||
this.objectId = objectId;
|
||||
this.questName = questName;
|
||||
this.stf = stf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(IoBuffer data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
|
||||
byte[] questNameBytes = getAsciiString(questName);
|
||||
byte[] stfBytes = getUnicodeString(stf);
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(38 + questNameBytes.length + stfBytes.length).order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
buffer.putInt(ObjControllerMessage.QUEST_TASK_COUNTER);
|
||||
buffer.putLong(objectId);
|
||||
buffer.putInt(0);
|
||||
|
||||
buffer.put(questNameBytes);
|
||||
buffer.putInt(1); // ??
|
||||
buffer.put(stfBytes);
|
||||
buffer.putInt(0); // ??
|
||||
buffer.putInt(1); // ??
|
||||
|
||||
return buffer.flip();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,66 +1,66 @@
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class QuestTaskTimerMessage extends ObjControllerObject {
|
||||
|
||||
private long objectId;
|
||||
private String questName;
|
||||
|
||||
public QuestTaskTimerMessage(long objectId, String questName) {
|
||||
this.objectId = objectId;
|
||||
this.questName = questName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(IoBuffer data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(16).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.setAutoExpand(true);
|
||||
buffer.putInt(ObjControllerMessage.QUEST_TASK_TIMER_MESSAGE);
|
||||
buffer.putLong(objectId);
|
||||
buffer.putInt(0);
|
||||
buffer.put(getAsciiString("quest/ep3_trando_hssissk_zssik_10"));
|
||||
buffer.putInt(1);
|
||||
buffer.put(getUnicodeString("quest/groundquests:destroy_counter"));
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(1);
|
||||
|
||||
int size = buffer.position();
|
||||
buffer = IoBuffer.allocate(size).put(buffer.array(), 0, size);
|
||||
|
||||
return buffer.flip();
|
||||
}
|
||||
|
||||
}
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
|
||||
public class QuestTaskTimerMessage extends ObjControllerObject {
|
||||
|
||||
private long objectId;
|
||||
private int count;
|
||||
private int taskId;
|
||||
private String questName;
|
||||
private String stf;
|
||||
|
||||
public QuestTaskTimerMessage(long objectId, String questName, String stf, int count) {
|
||||
this.objectId = objectId;
|
||||
this.count = count;
|
||||
this.questName = questName;
|
||||
this.stf = stf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(IoBuffer data) { }
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
byte[] nameBytes = getAsciiString(questName);
|
||||
byte[] stfBytes = getUnicodeString(stf);
|
||||
IoBuffer buffer = IoBuffer.allocate(24 + nameBytes.length + stfBytes.length).order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
buffer.putInt(ObjControllerMessage.QUEST_TASK_TIMER);
|
||||
buffer.putLong(objectId);
|
||||
buffer.putInt(0);
|
||||
|
||||
buffer.put(nameBytes);
|
||||
buffer.putInt(taskId);
|
||||
buffer.put(stfBytes);
|
||||
buffer.putInt(count);
|
||||
|
||||
return buffer.flip();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,11 +23,9 @@ package protocol.swg.objectControllerObjects;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import engine.resources.objects.SWGObject;
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
|
||||
public class ShowLootBox extends ObjControllerObject {
|
||||
|
||||
+339
-244
@@ -21,8 +21,6 @@
|
||||
******************************************************************************/
|
||||
package resources.buffs;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -30,50 +28,43 @@ import java.util.concurrent.TimeUnit;
|
||||
import main.NGECore;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
import org.apache.mina.core.buffer.SimpleBufferAllocator;
|
||||
|
||||
import resources.objects.creature.CreatureObject;
|
||||
|
||||
import com.sleepycat.persist.model.NotPersistent;
|
||||
import engine.clientdata.ClientFileManager;
|
||||
import engine.clientdata.visitors.DatatableVisitor;
|
||||
import engine.resources.objects.Delta;
|
||||
|
||||
import engine.resources.common.CRC;
|
||||
import engine.resources.objects.IDelta;
|
||||
import engine.resources.objects.SWGObject;
|
||||
|
||||
public class Buff implements IDelta, Serializable {
|
||||
public class Buff extends Delta {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@NotPersistent
|
||||
private transient static SimpleBufferAllocator bufferPool = new SimpleBufferAllocator();
|
||||
private String group1, group2;
|
||||
private int priority;
|
||||
private float duration;
|
||||
private String buffName;
|
||||
private long ownerId;
|
||||
private String effect1Name, effect2Name, effect3Name, effect4Name, effect5Name;
|
||||
|
||||
private String group1 = "", group2 = "";
|
||||
private int priority = 0;
|
||||
private float duration = 0;
|
||||
private String buffName = "";
|
||||
private long ownerId = 0;
|
||||
private String effect1Name = "", effect2Name = "", effect3Name = "", effect4Name = "", effect5Name = "";
|
||||
private float effect1Value, effect2Value, effect3Value, effect4Value, effect5Value;
|
||||
private String callback;
|
||||
private String particleEffect;
|
||||
private boolean isDebuff;
|
||||
private boolean removeOnDeath;
|
||||
private boolean isRemovableByPlayer;
|
||||
private int maxStacks;
|
||||
private boolean isPersistent;
|
||||
private boolean removeOnRespec;
|
||||
private boolean aiRemoveOnEndCombat;
|
||||
private boolean decayOnPvPDeath;
|
||||
private long startTime;
|
||||
private int totalPlayTime;
|
||||
private String callback = "";
|
||||
private String particleEffect = "";
|
||||
private boolean isDebuff = false;
|
||||
private boolean removeOnDeath = false;
|
||||
private boolean isRemovableByPlayer = false;
|
||||
private int maxStacks = 0;
|
||||
private boolean isPersistent = false;
|
||||
private boolean removeOnRespec = false;
|
||||
private boolean aiRemoveOnEndCombat = false;
|
||||
private boolean decayOnPvPDeath = false;
|
||||
private long startTime = 0;
|
||||
private int totalPlayTime = 0;
|
||||
private byte decayCounter = 0;
|
||||
@NotPersistent
|
||||
private transient ScheduledFuture<?> removalTask;
|
||||
private int stacks = 1;
|
||||
private long groupBufferId;
|
||||
private int buffCRC;
|
||||
private long groupBufferId = 0;
|
||||
|
||||
public Buff(Buff baseBuff, long ownerId) {
|
||||
this.buffName = baseBuff.getBuffName();
|
||||
this.buffCRC = baseBuff.getBuffCRC();
|
||||
this.group1 = baseBuff.getGroup1();
|
||||
this.group2 = baseBuff.getGroup2();
|
||||
this.priority = baseBuff.getPriority();
|
||||
@@ -100,398 +91,502 @@ public class Buff implements IDelta, Serializable {
|
||||
this.decayOnPvPDeath = baseBuff.isDecayOnPvPDeath();
|
||||
}
|
||||
|
||||
/*public Buff(String buffName, long ownerId) {
|
||||
|
||||
public Buff(String buffName, long ownerId) {
|
||||
this.buffName = buffName;
|
||||
this.ownerId = ownerId;
|
||||
this.buffCRC = CRC.StringtoCRC(buffName);
|
||||
|
||||
|
||||
DatatableVisitor visitor;
|
||||
|
||||
try {
|
||||
|
||||
visitor = ClientFileManager.loadFile("datatables/buff/buff.iff", DatatableVisitor.class);
|
||||
for(int i = 0; i < visitor.getRowCount(); i++) {
|
||||
|
||||
if(visitor.getObject(i, 0) != null)
|
||||
if(((String) visitor.getObject(i, 0)).equalsIgnoreCase(buffName)) {
|
||||
|
||||
group1 = (String) visitor.getObject(i, 1);
|
||||
group2 = (String) visitor.getObject(i, 2);
|
||||
priority = (int) visitor.getObject(i, 4);
|
||||
duration = (Float) visitor.getObject(i, 6);
|
||||
effect1Name = (String) visitor.getObject(i, 7);
|
||||
effect1Value = (Float) visitor.getObject(i, 8);
|
||||
effect2Name = (String) visitor.getObject(i, 9);
|
||||
effect2Value = (Float) visitor.getObject(i, 10);
|
||||
effect3Name = (String) visitor.getObject(i, 11);
|
||||
effect3Value = (Float) visitor.getObject(i, 12);
|
||||
effect4Name = (String) visitor.getObject(i, 13);
|
||||
effect4Value = (Float) visitor.getObject(i, 14);
|
||||
effect5Name = (String) visitor.getObject(i, 15);
|
||||
effect5Value = (Float) visitor.getObject(i, 16);
|
||||
callback = (String) visitor.getObject(i, 18);
|
||||
particleEffect = (String) visitor.getObject(i, 19);
|
||||
isDebuff = (Boolean) visitor.getObject(i, 22);
|
||||
removeOnDeath = (Integer) visitor.getObject(i, 25) != 0;
|
||||
isRemovableByPlayer = (Integer) visitor.getObject(i, 26) != 0;
|
||||
maxStacks = (Integer) visitor.getObject(i, 28);
|
||||
isPersistent = (Integer) visitor.getObject(i, 29) != 0;
|
||||
removeOnRespec = (Integer) visitor.getObject(i, 31) != 0;
|
||||
aiRemoveOnEndCombat = (Integer) visitor.getObject(i, 32) != 0;
|
||||
decayOnPvPDeath = (Integer) visitor.getObject(i, 33) != 0;
|
||||
|
||||
for (int i = 0; i < visitor.getRowCount(); i++) {
|
||||
if (visitor.getObject(i, 0) != null) {
|
||||
if (((String) visitor.getObject(i, 0)).equalsIgnoreCase(buffName)) {
|
||||
group1 = (String) visitor.getObject(i, 1);
|
||||
group2 = (String) visitor.getObject(i, 2);
|
||||
priority = (int) visitor.getObject(i, 4);
|
||||
duration = (Float) visitor.getObject(i, 6);
|
||||
effect1Name = (String) visitor.getObject(i, 7);
|
||||
effect1Value = (Float) visitor.getObject(i, 8);
|
||||
effect2Name = (String) visitor.getObject(i, 9);
|
||||
effect2Value = (Float) visitor.getObject(i, 10);
|
||||
effect3Name = (String) visitor.getObject(i, 11);
|
||||
effect3Value = (Float) visitor.getObject(i, 12);
|
||||
effect4Name = (String) visitor.getObject(i, 13);
|
||||
effect4Value = (Float) visitor.getObject(i, 14);
|
||||
effect5Name = (String) visitor.getObject(i, 15);
|
||||
effect5Value = (Float) visitor.getObject(i, 16);
|
||||
callback = (String) visitor.getObject(i, 18);
|
||||
particleEffect = (String) visitor.getObject(i, 19);
|
||||
isDebuff = (Boolean) visitor.getObject(i, 22);
|
||||
removeOnDeath = (Integer) visitor.getObject(i, 25) != 0;
|
||||
isRemovableByPlayer = (Integer) visitor.getObject(i, 26) != 0;
|
||||
maxStacks = (Integer) visitor.getObject(i, 28);
|
||||
isPersistent = (Integer) visitor.getObject(i, 29) != 0;
|
||||
removeOnRespec = (Integer) visitor.getObject(i, 31) != 0;
|
||||
aiRemoveOnEndCombat = (Integer) visitor.getObject(i, 32) != 0;
|
||||
decayOnPvPDeath = (Integer) visitor.getObject(i, 33) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}*/
|
||||
|
||||
public Buff() { }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(SWGObject object) {
|
||||
// TODO Auto-generated method stub
|
||||
public Buff() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytes() {
|
||||
|
||||
IoBuffer buffer = bufferPool.allocate(28, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
buffer.putInt(CRC.StringtoCRC(buffName.toLowerCase()));
|
||||
if(duration > 0) {
|
||||
buffer.putInt((int) (totalPlayTime + getRemainingDuration()));
|
||||
buffer.putInt(0);
|
||||
buffer.putInt((int) duration);
|
||||
} else {
|
||||
buffer.putInt(-1);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
synchronized(objectMutex) {
|
||||
IoBuffer buffer = createBuffer(24);
|
||||
if (duration > 0) {
|
||||
buffer.putInt((int) (totalPlayTime + getRemainingDuration()));
|
||||
buffer.putInt(0);
|
||||
buffer.putInt((int) duration);
|
||||
} else {
|
||||
buffer.putInt(-1);
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
}
|
||||
buffer.putLong(ownerId);
|
||||
buffer.putInt(stacks);
|
||||
buffer.flip();
|
||||
return buffer.array();
|
||||
}
|
||||
buffer.putLong(ownerId);
|
||||
buffer.putInt(stacks); // stacks
|
||||
|
||||
buffer.flip();
|
||||
|
||||
return buffer.array();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getGroup1() {
|
||||
return group1;
|
||||
synchronized(objectMutex) {
|
||||
return group1;
|
||||
}
|
||||
}
|
||||
|
||||
public void setGroup1(String group1) {
|
||||
this.group1 = group1;
|
||||
synchronized(objectMutex) {
|
||||
this.group1 = group1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getGroup2() {
|
||||
synchronized(objectMutex) {
|
||||
return group2;
|
||||
}
|
||||
}
|
||||
|
||||
public void setGroup2(String group2) {
|
||||
synchronized(objectMutex) {
|
||||
this.group2 = group2;
|
||||
}
|
||||
}
|
||||
|
||||
public int getPriority() {
|
||||
return priority;
|
||||
synchronized(objectMutex) {
|
||||
return priority;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPriority(int priority) {
|
||||
this.priority = priority;
|
||||
synchronized(objectMutex) {
|
||||
this.priority = priority;
|
||||
}
|
||||
}
|
||||
|
||||
public float getDuration() {
|
||||
return duration;
|
||||
synchronized(objectMutex) {
|
||||
return duration;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setDuration(float duration) {
|
||||
this.duration = duration;
|
||||
synchronized(objectMutex) {
|
||||
this.duration = duration;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getBuffName() {
|
||||
return buffName;
|
||||
synchronized(objectMutex) {
|
||||
return buffName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setBuffName(String buffName) {
|
||||
this.buffName = buffName;
|
||||
synchronized(objectMutex) {
|
||||
this.buffName = buffName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public long getOwnerId() {
|
||||
return ownerId;
|
||||
synchronized(objectMutex) {
|
||||
return ownerId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setOwnerId(long ownerId) {
|
||||
this.ownerId = ownerId;
|
||||
synchronized(objectMutex) {
|
||||
this.ownerId = ownerId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getEffect1Name() {
|
||||
return effect1Name;
|
||||
synchronized(objectMutex) {
|
||||
return effect1Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setEffect1Name(String effect1Name) {
|
||||
this.effect1Name = effect1Name;
|
||||
synchronized(objectMutex) {
|
||||
this.effect1Name = effect1Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getEffect2Name() {
|
||||
return effect2Name;
|
||||
synchronized(objectMutex) {
|
||||
return effect2Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setEffect2Name(String effect2Name) {
|
||||
this.effect2Name = effect2Name;
|
||||
synchronized(objectMutex) {
|
||||
this.effect2Name = effect2Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getEffect3Name() {
|
||||
return effect3Name;
|
||||
synchronized(objectMutex) {
|
||||
return effect3Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setEffect3Name(String effect3Name) {
|
||||
this.effect3Name = effect3Name;
|
||||
synchronized(objectMutex) {
|
||||
this.effect3Name = effect3Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getEffect4Name() {
|
||||
return effect4Name;
|
||||
synchronized(objectMutex) {
|
||||
return effect4Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setEffect4Name(String effect4Name) {
|
||||
this.effect4Name = effect4Name;
|
||||
synchronized(objectMutex) {
|
||||
this.effect4Name = effect4Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getEffect5Name() {
|
||||
return effect5Name;
|
||||
synchronized(objectMutex) {
|
||||
return effect5Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setEffect5Name(String effect5Name) {
|
||||
this.effect5Name = effect5Name;
|
||||
synchronized(objectMutex) {
|
||||
this.effect5Name = effect5Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public float getEffect1Value() {
|
||||
return effect1Value;
|
||||
synchronized(objectMutex) {
|
||||
return effect1Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setEffect1Value(float effect1Value) {
|
||||
this.effect1Value = effect1Value;
|
||||
synchronized(objectMutex) {
|
||||
this.effect1Value = effect1Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public float getEffect2Value() {
|
||||
return effect2Value;
|
||||
synchronized(objectMutex) {
|
||||
return effect2Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setEffect2Value(float effect2Value) {
|
||||
this.effect2Value = effect2Value;
|
||||
synchronized(objectMutex) {
|
||||
this.effect2Value = effect2Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public float getEffect3Value() {
|
||||
return effect3Value;
|
||||
synchronized(objectMutex) {
|
||||
return effect3Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setEffect3Value(float effect3Value) {
|
||||
this.effect3Value = effect3Value;
|
||||
synchronized(objectMutex) {
|
||||
this.effect3Value = effect3Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public float getEffect4Value() {
|
||||
return effect4Value;
|
||||
synchronized(objectMutex) {
|
||||
return effect4Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setEffect4Value(float effect4Value) {
|
||||
this.effect4Value = effect4Value;
|
||||
synchronized(objectMutex) {
|
||||
this.effect4Value = effect4Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public float getEffect5Value() {
|
||||
return effect5Value;
|
||||
synchronized(objectMutex) {
|
||||
return effect5Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setEffect5Value(float effect5Value) {
|
||||
this.effect5Value = effect5Value;
|
||||
synchronized(objectMutex) {
|
||||
this.effect5Value = effect5Value;
|
||||
}
|
||||
}
|
||||
|
||||
public String getCallback() {
|
||||
return callback;
|
||||
synchronized(objectMutex) {
|
||||
return callback;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCallback(String callback) {
|
||||
this.callback = callback;
|
||||
synchronized(objectMutex) {
|
||||
this.callback = callback;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getParticleEffect() {
|
||||
return particleEffect;
|
||||
synchronized(objectMutex) {
|
||||
return particleEffect;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setParticleEffect(String particleEffect) {
|
||||
this.particleEffect = particleEffect;
|
||||
synchronized(objectMutex) {
|
||||
this.particleEffect = particleEffect;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isDebuff() {
|
||||
return isDebuff;
|
||||
synchronized(objectMutex) {
|
||||
return isDebuff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setDebuff(boolean isDebuff) {
|
||||
this.isDebuff = isDebuff;
|
||||
synchronized(objectMutex) {
|
||||
this.isDebuff = isDebuff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isRemoveOnDeath() {
|
||||
return removeOnDeath;
|
||||
synchronized(objectMutex) {
|
||||
return removeOnDeath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setRemoveOnDeath(boolean removeOnDeath) {
|
||||
this.removeOnDeath = removeOnDeath;
|
||||
synchronized(objectMutex) {
|
||||
this.removeOnDeath = removeOnDeath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isRemovableByPlayer() {
|
||||
return isRemovableByPlayer;
|
||||
synchronized(objectMutex) {
|
||||
return isRemovableByPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setRemovableByPlayer(boolean isRemovableByPlayer) {
|
||||
this.isRemovableByPlayer = isRemovableByPlayer;
|
||||
synchronized(objectMutex) {
|
||||
this.isRemovableByPlayer = isRemovableByPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getMaxStacks() {
|
||||
return maxStacks;
|
||||
synchronized(objectMutex) {
|
||||
return maxStacks;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setMaxStacks(int maxStacks) {
|
||||
this.maxStacks = maxStacks;
|
||||
synchronized(objectMutex) {
|
||||
this.maxStacks = maxStacks;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isPersistent() {
|
||||
return isPersistent;
|
||||
synchronized(objectMutex) {
|
||||
return isPersistent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setPersistent(boolean isPersistent) {
|
||||
this.isPersistent = isPersistent;
|
||||
synchronized(objectMutex) {
|
||||
this.isPersistent = isPersistent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isRemoveOnRespec() {
|
||||
return removeOnRespec;
|
||||
synchronized(objectMutex) {
|
||||
return removeOnRespec;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setRemoveOnRespec(boolean removeOnRespec) {
|
||||
this.removeOnRespec = removeOnRespec;
|
||||
synchronized(objectMutex) {
|
||||
this.removeOnRespec = removeOnRespec;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isAiRemoveOnEndCombat() {
|
||||
return aiRemoveOnEndCombat;
|
||||
synchronized(objectMutex) {
|
||||
return aiRemoveOnEndCombat;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setAiRemoveOnEndCombat(boolean aiRemoveOnEndCombat) {
|
||||
this.aiRemoveOnEndCombat = aiRemoveOnEndCombat;
|
||||
synchronized(objectMutex) {
|
||||
this.aiRemoveOnEndCombat = aiRemoveOnEndCombat;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean isDecayOnPvPDeath() {
|
||||
return decayOnPvPDeath;
|
||||
synchronized(objectMutex) {
|
||||
return decayOnPvPDeath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setDecayOnPvPDeath(boolean decayOnPvPDeath) {
|
||||
this.decayOnPvPDeath = decayOnPvPDeath;
|
||||
synchronized(objectMutex) {
|
||||
this.decayOnPvPDeath = decayOnPvPDeath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setStartTime() {
|
||||
this.startTime = System.currentTimeMillis();
|
||||
synchronized(objectMutex) {
|
||||
this.startTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
synchronized(objectMutex) {
|
||||
return startTime;
|
||||
}
|
||||
}
|
||||
|
||||
public int getRemainingDuration() {
|
||||
|
||||
long currentTime = System.currentTimeMillis();
|
||||
long timeDiff = (currentTime - startTime) / 1000;
|
||||
int remaining = (int) (duration - timeDiff);
|
||||
for(int i = 0; i < decayCounter; i++) {
|
||||
remaining /= 2;
|
||||
synchronized(objectMutex) {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
long timeDiff = (currentTime - startTime) / 1000;
|
||||
int remaining = (int) (duration - timeDiff);
|
||||
|
||||
for (int i = 0; i < decayCounter; i++) {
|
||||
remaining /= 2;
|
||||
}
|
||||
|
||||
return remaining;
|
||||
}
|
||||
return remaining;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getTotalPlayTime() {
|
||||
return totalPlayTime;
|
||||
synchronized(objectMutex) {
|
||||
return totalPlayTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setTotalPlayTime(int totalPlayTime) {
|
||||
this.totalPlayTime = totalPlayTime;
|
||||
synchronized(objectMutex) {
|
||||
this.totalPlayTime = totalPlayTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public byte getDecayCounter() {
|
||||
return decayCounter;
|
||||
synchronized(objectMutex) {
|
||||
return decayCounter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void incDecayCounter() {
|
||||
this.decayCounter++;
|
||||
synchronized(objectMutex) {
|
||||
this.decayCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ScheduledFuture<?> getRemovalTask() {
|
||||
return removalTask;
|
||||
}
|
||||
|
||||
|
||||
public void setRemovalTask(ScheduledFuture<?> removalTask) {
|
||||
this.removalTask = removalTask;
|
||||
}
|
||||
|
||||
public void updateRemovalTask() {
|
||||
|
||||
if(removalTask == null)
|
||||
if (removalTask == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
removalTask.cancel(true);
|
||||
|
||||
final NGECore core = NGECore.getInstance();
|
||||
final CreatureObject owner = (CreatureObject) core.objectService.getObject(getOwnerId());
|
||||
|
||||
if(owner == null)
|
||||
if (owner == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ScheduledFuture<?> task = Executors.newScheduledThreadPool(1).schedule(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
try {
|
||||
core.buffService.removeBuffFromCreature(owner, Buff.this);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}, (long) getRemainingDuration(), TimeUnit.SECONDS);
|
||||
|
||||
setRemovalTask(task);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getStacks() {
|
||||
return stacks;
|
||||
synchronized(objectMutex) {
|
||||
return stacks;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setStacks(int stacks) {
|
||||
this.stacks = stacks;
|
||||
synchronized(objectMutex) {
|
||||
this.stacks = stacks;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isGroupBuff() {
|
||||
return effect1Name == null ? false : effect1Name.equals("group");
|
||||
}
|
||||
|
||||
public long getGroupBufferId() {
|
||||
return groupBufferId;
|
||||
}
|
||||
|
||||
public void setGroupBufferId(long groupBufferId) {
|
||||
this.groupBufferId = groupBufferId;
|
||||
}
|
||||
|
||||
public String getGroup2() {
|
||||
return group2;
|
||||
}
|
||||
|
||||
public void setGroup2(String group2) {
|
||||
this.group2 = group2;
|
||||
}
|
||||
|
||||
public int getBuffCRC() {
|
||||
return buffCRC;
|
||||
synchronized(objectMutex) {
|
||||
return effect1Name.equals("group");
|
||||
}
|
||||
}
|
||||
|
||||
public void setBuffCRC(int buffCRC) {
|
||||
this.buffCRC = buffCRC;
|
||||
public long getGroupBufferId() {
|
||||
synchronized(objectMutex) {
|
||||
return groupBufferId;
|
||||
}
|
||||
}
|
||||
|
||||
public void setGroupBufferId(long groupBufferId) {
|
||||
synchronized(objectMutex) {
|
||||
this.groupBufferId = groupBufferId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/*******************************************************************************
|
||||
* 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.buffs;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import engine.resources.objects.Delta;
|
||||
import resources.objects.SWGMap;
|
||||
|
||||
public class BuffList extends Delta {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SWGMap<Integer, Buff> list;
|
||||
|
||||
public BuffList(SWGMap<Integer, Buff> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public BuffList() {
|
||||
|
||||
}
|
||||
|
||||
public SWGMap<Integer, Buff> getList() {
|
||||
synchronized(objectMutex) {
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] getBytes() {
|
||||
int size = 8 + ((list.size() > 0) ? 4 : 0);
|
||||
|
||||
for (Buff buff : list.values().toArray(new Buff[] { })) {
|
||||
size += (25 + ((buff.getBuffName().equals("")) ? 0 : 4));
|
||||
}
|
||||
|
||||
IoBuffer buffer = createBuffer(size);
|
||||
buffer.putInt(list.size());
|
||||
buffer.putInt(list.getUpdateCounter());
|
||||
for (Entry<Integer, Buff> entry : list.entrySet()) {
|
||||
int crc = entry.getKey();
|
||||
Buff buff = entry.getValue();
|
||||
|
||||
buffer.put(getBoolean(!buff.getBuffName().equals("")));
|
||||
if (!buff.getBuffName().equals("")) {
|
||||
buffer.putInt(0);
|
||||
}
|
||||
buffer.putInt(crc);
|
||||
if (buff.getDuration() > 0) {
|
||||
buffer.putInt((int) (buff.getTotalPlayTime() + buff.getRemainingDuration()));
|
||||
buffer.putInt(0);
|
||||
buffer.putInt((int) buff.getDuration());
|
||||
} else {
|
||||
buffer.putInt(-1);
|
||||
buffer.putInt(0);
|
||||
if (buff.getBuffName().equals("")) {
|
||||
buffer.putInt(0);
|
||||
} else {
|
||||
buffer.putInt(-1);
|
||||
}
|
||||
}
|
||||
buffer.putLong(buff.getOwnerId());
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
buffer.putInt(1);
|
||||
}
|
||||
return buffer.array();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
|
||||
import engine.resources.common.Stf;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Point3D;
|
||||
import main.NGECore;
|
||||
@@ -250,7 +251,7 @@ public class Forager {
|
||||
adversaryRoll=999;
|
||||
|
||||
// adversaryRoll=999; // To test TMs
|
||||
|
||||
|
||||
if (adversaryRoll<14) { // 14 100 // To test TMs
|
||||
int adversaryTypeRoll = new Random().nextInt(100);
|
||||
if (adversaryTypeRoll<50){
|
||||
@@ -417,18 +418,17 @@ public class Forager {
|
||||
|
||||
}
|
||||
|
||||
goon.addObserver(forager);
|
||||
// goon.addObserver(forager);
|
||||
goon.setCustomName(name);
|
||||
goon.setLevel(forager.getLevel());
|
||||
goon.setOptions(Options.AGGRESSIVE, true);
|
||||
goon.setOptions(Options.ATTACKABLE, true);
|
||||
// goon.setOptions(Options.AGGRESSIVE, true);
|
||||
// goon.setOptions(Options.ATTACKABLE, true);
|
||||
AIActor actor = (AIActor) goon.getAttachment("AI");
|
||||
actor.addDefender(forager);
|
||||
forager.sendSystemMessage("@foraging/forage_enemy:" + barkString, DisplayType.Broadcast);
|
||||
//OutOfBand oob = OutOfBand.ProsePackage("@foraging/forage_enemy:" + barkString));
|
||||
OutOfBand oob = OutOfBand.ProsePackage("@jawa_trader:cant_understand");
|
||||
forager.sendSystemMessage("@jawa_trader:cant_understand", DisplayType.Broadcast);
|
||||
NGECore.getInstance().chatService.spatialChat(goon, forager, "", (short)0x0, (short)0x0, 1, oob);
|
||||
OutOfBand oob = OutOfBand.ProsePackage("@foraging/forage_enemy:" + barkString);
|
||||
Stf stf = new Stf("@foraging/forage_enemy:" + barkString);
|
||||
NGECore.getInstance().chatService.spatialChat(goon, forager, stf.getStfValue(), (short)0x0, (short)0x0, 1, oob);
|
||||
}
|
||||
|
||||
public void handleGuardSpawn(CreatureObject owner, TangibleObject map){
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/*******************************************************************************
|
||||
* 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.equipment;
|
||||
|
||||
import main.NGECore;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import engine.resources.common.CRC;
|
||||
import engine.resources.objects.Delta;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.weapon.WeaponObject;
|
||||
|
||||
public class Equipment extends Delta {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private long objectId;
|
||||
|
||||
public Equipment(SWGObject object) {
|
||||
this.objectId = ((object instanceof TangibleObject) ? object.getObjectID() : 0);
|
||||
}
|
||||
|
||||
public Equipment() {
|
||||
|
||||
}
|
||||
|
||||
public SWGObject getObject() {
|
||||
synchronized(objectMutex) {
|
||||
return NGECore.getInstance().objectService.getObject(objectId);
|
||||
}
|
||||
}
|
||||
|
||||
public long getObjectId() {
|
||||
synchronized(objectMutex) {
|
||||
return objectId;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] getBytes() {
|
||||
if (!(getObject() instanceof TangibleObject)) {
|
||||
if (getObject() == null) {
|
||||
System.err.println("Serious error: Equipment object is null in objectList.");
|
||||
} else {
|
||||
System.err.println("Serious error: Equipment object isn't a TangibleObject");
|
||||
}
|
||||
}
|
||||
|
||||
TangibleObject object = (TangibleObject) getObject();
|
||||
|
||||
synchronized(objectMutex) {
|
||||
int size = 19 + object.getCustomization ().length;
|
||||
|
||||
if (object instanceof WeaponObject) {
|
||||
size += ((WeaponObject) object).getBaseline(3).getBaseline().array().length;
|
||||
size += ((WeaponObject) object).getBaseline(6).getBaseline().array().length;
|
||||
}
|
||||
|
||||
IoBuffer buffer = createBuffer(size);
|
||||
buffer.putShort((short) object.getCustomization().length);
|
||||
buffer.put(object.getCustomization());
|
||||
buffer.putInt(object.getArrangementId());
|
||||
buffer.putLong(object.getObjectID());
|
||||
buffer.putInt(CRC.StringtoCRC(object.getTemplate()));
|
||||
buffer.put(getBoolean((object instanceof WeaponObject)));
|
||||
if (object instanceof WeaponObject) {
|
||||
buffer.put(((WeaponObject) object).getBaseline(3).getBaseline().array());
|
||||
buffer.put(((WeaponObject) object).getBaseline(6).getBaseline().array());
|
||||
}
|
||||
buffer.flip();
|
||||
|
||||
return buffer.array();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*******************************************************************************
|
||||
* 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.group;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import engine.resources.common.AString;
|
||||
import engine.resources.objects.Delta;
|
||||
|
||||
public class GroupInviteInfo extends Delta {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private long senderId;
|
||||
private AString senderName;
|
||||
private long inviteCounter;
|
||||
|
||||
public GroupInviteInfo(long senderId, String senderName) {
|
||||
this.senderId = senderId;
|
||||
this.senderName = new AString(senderName);
|
||||
inviteCounter = 0;
|
||||
}
|
||||
|
||||
public GroupInviteInfo() {
|
||||
|
||||
}
|
||||
|
||||
public long getSenderId() {
|
||||
synchronized(objectMutex) {
|
||||
return senderId;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSenderName() {
|
||||
synchronized(objectMutex) {
|
||||
return senderName.get();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSender(long senderId, String senderName) {
|
||||
synchronized(objectMutex) {
|
||||
this.senderId = senderId;
|
||||
this.senderName = new AString(senderName);
|
||||
inviteCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] getBytes() {
|
||||
synchronized(objectMutex) {
|
||||
IoBuffer buffer = createBuffer(16 + senderName.getBytes().length);
|
||||
buffer.putLong(senderId);
|
||||
buffer.put(senderName.getBytes());
|
||||
buffer.putLong(inviteCounter);
|
||||
return buffer.array();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,7 +54,6 @@ public class SWGList<E> implements List<E>, Serializable {
|
||||
private byte viewType;
|
||||
private short updateType;
|
||||
private boolean addByte;
|
||||
private boolean questMethod;
|
||||
protected transient Object objectMutex = new Object();
|
||||
private transient SWGObject object;
|
||||
|
||||
@@ -67,14 +66,6 @@ public class SWGList<E> implements List<E>, Serializable {
|
||||
this.object = object;
|
||||
}
|
||||
|
||||
public SWGList(SWGObject object, int viewType, int updateType, boolean addByte, boolean questMethod) {
|
||||
this.viewType = (byte) viewType;
|
||||
this.updateType = (short) updateType;
|
||||
this.addByte = addByte;
|
||||
this.object = object;
|
||||
this.questMethod = questMethod;
|
||||
}
|
||||
|
||||
public void init(SWGObject object) {
|
||||
objectMutex = new Object();
|
||||
updateCounter = 0;
|
||||
@@ -94,19 +85,7 @@ public class SWGList<E> implements List<E>, Serializable {
|
||||
public boolean add(E e) {
|
||||
synchronized(objectMutex) {
|
||||
if (valid(e) && list.add(e)) {
|
||||
if (!questMethod) queue(item(1, list.lastIndexOf(e), Baseline.toBytes(e), true, true));
|
||||
else {
|
||||
List<byte[]> buffer = new ArrayList<byte[]>();
|
||||
|
||||
int index = 0;
|
||||
for (E element : list) {
|
||||
buffer.add(item(1, index, Baseline.toBytes(element), true, true));
|
||||
index++;
|
||||
}
|
||||
queue(buffer);
|
||||
|
||||
return true;
|
||||
}
|
||||
queue(item(1, list.lastIndexOf(e), Baseline.toBytes(e), true, true));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -462,17 +441,7 @@ public class SWGList<E> implements List<E>, Serializable {
|
||||
}
|
||||
|
||||
private byte[] item(int type, int index, byte[] data, boolean useIndex, boolean useData) {
|
||||
if (questMethod) {
|
||||
int size = data.length;
|
||||
|
||||
IoBuffer buffer = Delta.createBuffer(size);
|
||||
buffer.put(data);
|
||||
buffer.flip();
|
||||
updateCounter++;
|
||||
|
||||
return buffer.array();
|
||||
}
|
||||
|
||||
|
||||
int size = 1 + ((useIndex) ? 2 : 0) + ((useData) ? data.length : 0);
|
||||
|
||||
IoBuffer buffer = Delta.createBuffer(size);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -47,6 +47,7 @@ import resources.objects.waypoint.WaypointObject;
|
||||
import resources.quest.Quest;
|
||||
import services.quest.QuestItem;
|
||||
import engine.clients.Client;
|
||||
import engine.resources.common.StringUtilities;
|
||||
import engine.resources.objects.Baseline;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
@@ -161,7 +162,7 @@ public class PlayerObject extends IntangibleObject implements Serializable {
|
||||
baseline.put("currentFSQuestList", new SWGList<Byte>(this, 8, 4, false));
|
||||
baseline.put("completedFSQuestList", new SWGList<Byte>(this, 8, 5, false));
|
||||
baseline.put("activeQuest", 0);
|
||||
baseline.put("questJournal", new SWGList<Quest>(this, 8, 7, false, true));
|
||||
baseline.put("questJournal", new SWGMap<Integer, Quest>(this, 8, 7, true));
|
||||
baseline.put("professionWheelPosition", "");
|
||||
return baseline;
|
||||
}
|
||||
@@ -591,8 +592,8 @@ public class PlayerObject extends IntangibleObject implements Serializable {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public SWGList<Quest> getQuestJournal() {
|
||||
return (SWGList<Quest>) getBaseline(8).get("questJournal");
|
||||
public SWGMap<Integer, Quest> getQuestJournal() {
|
||||
return (SWGMap<Integer, Quest>) getBaseline(8).get("questJournal");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -600,11 +601,6 @@ public class PlayerObject extends IntangibleObject implements Serializable {
|
||||
return (TreeMap<String, QuestItem>) otherVariables.get("questRetrieveItemTemplates");
|
||||
}
|
||||
|
||||
public boolean hasRetrieveItemTemplate(String template) {
|
||||
TreeMap<String, QuestItem> templates = getQuestRetrieveItemTemplates();
|
||||
return templates.containsKey(template);
|
||||
}
|
||||
|
||||
public int getActiveQuest() {
|
||||
return (int) getBaseline(8).get("activeQuest");
|
||||
}
|
||||
@@ -1044,10 +1040,19 @@ public class PlayerObject extends IntangibleObject implements Serializable {
|
||||
getContainer().notifyObservers(getBaseline(viewType).createDelta(updateType, buffer.array()), true);
|
||||
}
|
||||
|
||||
break;
|
||||
case 8:
|
||||
switch (updateType) {
|
||||
case 7:
|
||||
IoBuffer newBuffer = getBaseline(viewType).createDelta(updateType, buffer.array());
|
||||
getContainer().getClient().getSession().write(newBuffer.array());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (getContainer() != null && getContainer().getClient() != null) {
|
||||
getContainer().getClient().getSession().write(getBaseline(viewType).createDelta(updateType, buffer.array()));
|
||||
StringUtilities.printBytes(getBaseline(viewType).createDelta(updateType, buffer.array()).array());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,11 +130,11 @@ public class Quest extends Delta implements Serializable {
|
||||
byte[] activeStepBytes = activeStepBitmask.toByteArray();
|
||||
byte[] completedStepBytes = completedStepBitmask.toByteArray();
|
||||
|
||||
IoBuffer buffer = createBuffer(23);
|
||||
IoBuffer buffer = createBuffer(18);
|
||||
|
||||
buffer.put((byte) 0);
|
||||
//buffer.put((byte) 0);
|
||||
|
||||
buffer.putInt(getCrc());
|
||||
//buffer.putInt(getCrc());
|
||||
|
||||
buffer.putLong(ownerId); // quest giver id?
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class AdminService implements INetworkDispatch {
|
||||
PreparedStatement preparedStatement;
|
||||
|
||||
try {
|
||||
preparedStatement = NGECore.getInstance().getDatabase1().preparedStatement("SELECT * FROM accounts WHERE id=" + id + "");
|
||||
preparedStatement = core.getDatabase1().preparedStatement("SELECT * FROM accounts WHERE id=" + id + "");
|
||||
ResultSet resultSet = preparedStatement.executeQuery();
|
||||
if(resultSet.next())
|
||||
accessLevel = resultSet.getString("accessLevel");
|
||||
@@ -60,7 +60,7 @@ public class AdminService implements INetworkDispatch {
|
||||
PreparedStatement preparedStatement;
|
||||
|
||||
try {
|
||||
preparedStatement = NGECore.getInstance().getDatabase1().preparedStatement("SELECT * FROM accounts WHERE id=" + id + "");
|
||||
preparedStatement = core.getDatabase1().preparedStatement("SELECT * FROM accounts WHERE id=" + id + "");
|
||||
ResultSet resultSet = preparedStatement.executeQuery();
|
||||
if(resultSet.next())
|
||||
accountName = resultSet.getString("user");
|
||||
|
||||
@@ -43,7 +43,6 @@ import resources.objects.player.PlayerObject;
|
||||
import main.NGECore;
|
||||
import engine.clientdata.ClientFileManager;
|
||||
import engine.clientdata.visitors.DatatableVisitor;
|
||||
import engine.resources.common.CRC;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.service.INetworkDispatch;
|
||||
import engine.resources.service.INetworkRemoteEvent;
|
||||
@@ -114,6 +113,7 @@ public class BuffService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
// Here the necessary checks must be placed to prevent buffs from the same buff group (e.g. Buff D) being stacked!
|
||||
// ^ These checks are already performed in doAddBuff, unless they were removed.
|
||||
|
||||
if(buff.isGroupBuff()) {
|
||||
addGroupBuff(buffer, buffName, buffer);
|
||||
@@ -135,6 +135,8 @@ public class BuffService implements INetworkDispatch {
|
||||
//TODO fix this -- !! this is wrong - I can buff from 5,5 in cantina someone sitting at 20,20 in the universe/planet !!! - accross the galaxy/planet
|
||||
//cause get position is relative to creature system of coordinates - when one's outside and other inside
|
||||
//if you must use getPosition() check for isInCell first for both or something like that
|
||||
// ^The above bug should be fixed in command service. The checks below shouldn't really even be in this service.
|
||||
|
||||
if (target.getPosition().getDistance(buffer.getPosition()) > 20) {
|
||||
return null;
|
||||
}
|
||||
@@ -165,7 +167,7 @@ public class BuffService implements INetworkDispatch {
|
||||
|
||||
|
||||
|
||||
for (final Buff otherBuff : target.getBuffList()) {
|
||||
for (final Buff otherBuff : target.getBuffList().values()) {
|
||||
if (buff.getGroup1().equals(otherBuff.getGroup1()))
|
||||
if (buff.getPriority() >= otherBuff.getPriority()) {
|
||||
if (buff.getBuffName().equals(otherBuff.getBuffName()))
|
||||
@@ -270,7 +272,7 @@ public class BuffService implements INetworkDispatch {
|
||||
@SuppressWarnings("unused")
|
||||
public void removeBuffFromCreature(CreatureObject creature, Buff buff)
|
||||
{
|
||||
if(!creature.getBuffList().contains(buff))
|
||||
if(!creature.getBuffList().containsValue(buff))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -371,7 +373,7 @@ public class BuffService implements INetworkDispatch {
|
||||
|
||||
// copy to array for thread safety
|
||||
|
||||
for(final Buff buff : creature.getBuffList().get().toArray(new Buff[] { })) {
|
||||
for(final Buff buff : creature.getBuffList().values().toArray(new Buff[] { })) {
|
||||
|
||||
if (buff.getRemovalTask() != null) { continue; }
|
||||
|
||||
@@ -403,7 +405,7 @@ public class BuffService implements INetworkDispatch {
|
||||
|
||||
public boolean hasBuff(final CreatureObject creature, String buffName) {
|
||||
|
||||
for(final Buff buff : creature.getBuffList().get().toArray(new Buff[] { })) {
|
||||
for(final Buff buff : creature.getBuffList().values().toArray(new Buff[] { })) {
|
||||
if (buff.getBuffName().contains(buffName)) { return true; }
|
||||
}
|
||||
return false;
|
||||
@@ -502,7 +504,6 @@ public class BuffService implements INetworkDispatch {
|
||||
String name = (String) visitor.getObject(i, 0);
|
||||
|
||||
buff.setBuffName(name);
|
||||
buff.setBuffCRC(CRC.StringtoCRC(name));
|
||||
buff.setGroup1((String) visitor.getObject(i, 1));
|
||||
buff.setGroup2((String) visitor.getObject(i, 2));
|
||||
buff.setPriority((int) visitor.getObject(i, 4));
|
||||
|
||||
@@ -363,6 +363,8 @@ public class CharacterService implements INetworkDispatch {
|
||||
createStarterClothing(object, sharedRaceTemplate, clientCreateCharacter.getStarterProfession());
|
||||
//core.scriptService.callScript("scripts/", "demo", "CreateStartingCharacter", core, object);
|
||||
|
||||
session.setAttribute("CmdSceneReady", false);
|
||||
|
||||
System.out.println("Saving character with name: " + object.getCustomName());
|
||||
core.getSWGObjectODB().put(object.getObjectID(), object);
|
||||
|
||||
|
||||
@@ -688,12 +688,14 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
public void startPerformance(CreatureObject actor, int performanceId, int performanceCounter, String skillName, boolean isDance) {
|
||||
actor.setPerformanceId(performanceId, isDance);
|
||||
actor.setPerformanceId((isDance) ? 0 : performanceId);
|
||||
actor.setPerformanceCounter(performanceCounter);
|
||||
actor.setCurrentAnimation(skillName);
|
||||
actor.setPerformanceType(isDance);
|
||||
|
||||
actor.startPerformance();
|
||||
if (!actor.isPerforming()) {
|
||||
actor.setPerforming(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void startPerformanceExperience(final CreatureObject entertainer) {
|
||||
@@ -722,13 +724,13 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
|
||||
}
|
||||
|
||||
public void startSpectating(final CreatureObject spectator, final CreatureObject performer, boolean spectateType) {
|
||||
public void startSpectating(final CreatureObject spectator, final CreatureObject performer, String spectateType) {
|
||||
|
||||
// visual
|
||||
if (spectator.getPerformanceWatchee() == performer && spectateType)
|
||||
if (spectator.getPerformanceWatchee() == performer && spectateType.equals("dance"))
|
||||
spectator.getPerformanceWatchee().removeSpectator(spectator);
|
||||
// music
|
||||
else if (spectator.getPerformanceListenee() == performer && !spectateType)
|
||||
else if (spectator.getPerformanceListenee() == performer && spectateType.equals("musci"))
|
||||
spectator.getPerformanceListenee().removeSpectator(spectator);
|
||||
|
||||
spectator.setPerformanceWatchee(performer);
|
||||
@@ -739,7 +741,7 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
try {
|
||||
if (spectator.getWorldPosition().getDistance2D(performer.getWorldPosition()) > (float) 70) {
|
||||
|
||||
if(((performer.getPerformanceType()) ? "dance" : "music").equals("dance")) {
|
||||
if(performer.getPerformanceType().equals("dance")) {
|
||||
spectator.setPerformanceWatchee(null);
|
||||
spectator.sendSystemMessage("You stop watching " + performer.getCustomName() + " because " + performer.getCustomName()
|
||||
+ " is out of range.", (byte) 0);
|
||||
@@ -770,7 +772,7 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
handleInspirationTicks(spectator, performer);
|
||||
}
|
||||
|
||||
if(spectateType)
|
||||
if(spectateType.equals("dance"))
|
||||
spectator.sendSystemMessage("You start watching " + performer.getCustomName() + ".", (byte) 0);
|
||||
else
|
||||
spectator.sendSystemMessage("You start listening to " + performer.getCustomName() + ".", (byte) 0);
|
||||
@@ -778,7 +780,7 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
public void performFlourish(final CreatureObject performer, int flourish) {
|
||||
|
||||
// FIXME There wasn't a limit on flourishes; they just queued up.
|
||||
if (performer.getFlourishCount() > 0 || performer.isPerformingFlourish()) {
|
||||
performer.sendSystemMessage("@performance:flourish_wait_self", (byte) 0);
|
||||
return;
|
||||
@@ -814,7 +816,7 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
if(pEffect == null)
|
||||
return false;
|
||||
|
||||
String performance = (performer.getPerformanceType()) ? "dance" : "music";
|
||||
String performance = performer.getPerformanceType();
|
||||
|
||||
if(performer.isPerformingEffect()) {
|
||||
performer.sendSystemMessage("@performance:effect_wait_self", (byte) 0);
|
||||
|
||||
@@ -209,7 +209,7 @@ public class GroupService implements INetworkDispatch {
|
||||
// loop until we find a member other than ourself
|
||||
for(SWGObject otherMember : group.getMemberList()) {
|
||||
if(otherMember != member) {
|
||||
for(Buff buff : ((CreatureObject) otherMember).getBuffList().get()) {
|
||||
for(Buff buff : ((CreatureObject) otherMember).getBuffList().values()) {
|
||||
if(buff.isGroupBuff() && otherMember.getPlanet() == member.getPlanet() && otherMember.getWorldPosition().getDistance2D(member.getWorldPosition()) <= 80) {
|
||||
core.buffService.addBuffToCreature((CreatureObject) otherMember, buff.getBuffName(), member);
|
||||
}
|
||||
@@ -221,7 +221,7 @@ public class GroupService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
public void removeGroupBuffs(CreatureObject member) {
|
||||
for(Buff buff : new ArrayList<Buff>(member.getBuffList().get())) {
|
||||
for(Buff buff : new ArrayList<Buff>(member.getBuffList().values())) {
|
||||
if(buff.isGroupBuff() && buff.getGroupBufferId() != member.getObjectID()) {
|
||||
core.buffService.removeBuffFromCreature(member, buff);
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ public class LootService implements INetworkDispatch {
|
||||
if (droppedItem.getAttachment("LootItemName").toString().contains("Loot Chest")){
|
||||
|
||||
lootedObject.playEffectObject("appearance/pt_rare_chest.prt", "");
|
||||
requester.playMusicSelf("sound/rare_loot_chest.snd", requester.getObjectID(),1,false);
|
||||
requester.playMusic("sound/rare_loot_chest.snd", requester.getObjectID(),1,false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ import resources.datatables.GcwRank;
|
||||
import resources.datatables.Options;
|
||||
import resources.datatables.PlayerFlags;
|
||||
import resources.datatables.Professions;
|
||||
import resources.equipment.Equipment;
|
||||
import resources.datatables.AdminTag;
|
||||
import resources.guild.Guild;
|
||||
import resources.objects.building.BuildingObject;
|
||||
@@ -191,7 +192,7 @@ public class PlayerService implements INetworkDispatch {
|
||||
|
||||
scheduleList.add(scheduler.scheduleAtFixedRate(() -> {
|
||||
try {
|
||||
if (creature.isInStealth() && !creature.getOption(Options.INVULNERABLE) && core.adminService.getAccessLevelFromDB(creature.getClient().getAccountId()) == null) {
|
||||
if (creature.isCloaked() && !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) {
|
||||
@@ -209,7 +210,7 @@ public class PlayerService implements INetworkDispatch {
|
||||
camoflauge -= (64 - creature.getPosition().getDistance(observer.getPosition()));
|
||||
|
||||
if (new Random(camoflauge).nextInt() == camoflauge) {
|
||||
creature.setInStealth(false);
|
||||
creature.setCloaked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -662,7 +663,7 @@ public class PlayerService implements INetworkDispatch {
|
||||
creature.setTurnRadius(1);
|
||||
|
||||
if(pvpDeath) {
|
||||
List<Buff> buffs = new ArrayList<Buff>(creature.getBuffList().get());
|
||||
List<Buff> buffs = new ArrayList<Buff>(creature.getBuffList().values());
|
||||
buffs.stream().filter(Buff::isDecayOnPvPDeath).forEach(Buff::incDecayCounter);
|
||||
creature.updateAllBuffs();
|
||||
}
|
||||
@@ -754,38 +755,39 @@ public class PlayerService implements INetworkDispatch {
|
||||
public void resetLevel(CreatureObject creature, boolean unequipItems) {
|
||||
PlayerObject player = (PlayerObject) creature.getSlottedObject("ghost");
|
||||
SWGObject inventory = creature.getSlottedObject("inventory");
|
||||
|
||||
|
||||
if (unequipItems) {
|
||||
try {
|
||||
for (Long equipmentId : new ArrayList<Long>(creature.getEquipmentList())) {
|
||||
|
||||
SWGObject equipment = core.objectService.getObject(equipmentId);
|
||||
|
||||
for (Equipment equipmentObject : new ArrayList<Equipment>(creature.getEquipmentList())) {
|
||||
|
||||
SWGObject equipment = core.objectService.getObject(equipmentObject.getObjectId());
|
||||
|
||||
if (equipment == null || equipment.getTemplate().startsWith("object/tangible/hair/")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
switch (equipment.getTemplate()) {
|
||||
case "object/tangible/inventory/shared_character_inventory.iff":
|
||||
case "object/tangible/inventory/shared_appearance_inventory.iff":
|
||||
case "object/tangible/datapad/shared_character_datapad.iff":
|
||||
case "object/tangible/bank/shared_character_bank.iff":
|
||||
case "object/tangible/mission_bag/shared_mission_bag.iff":
|
||||
case "object/weapon/creature/shared_creature_default_weapon.iff":
|
||||
continue;
|
||||
default:
|
||||
creature.transferTo(creature, inventory, equipment);
|
||||
case "object/tangible/inventory/shared_character_inventory.iff":
|
||||
case "object/tangible/inventory/shared_appearance_inventory.iff":
|
||||
case "object/tangible/datapad/shared_character_datapad.iff":
|
||||
case "object/tangible/bank/shared_character_bank.iff":
|
||||
case "object/tangible/mission_bag/shared_mission_bag.iff":
|
||||
case "object/weapon/creature/shared_creature_default_weapon.iff":
|
||||
continue;
|
||||
default:
|
||||
creature.transferTo(creature, inventory, equipment);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//for (SWGObject equipment : creature.getAppearanceEquipmentList()) {
|
||||
//core.equipmentService.unequip(creature, equipment);
|
||||
//}
|
||||
|
||||
for (Buff buff : creature.getBuffList().get().toArray(new Buff[] { })) {
|
||||
for (Buff buff : creature.getBuffList().values().toArray(new Buff[] { })) {
|
||||
if (buff.isRemoveOnRespec()) {
|
||||
core.buffService.removeBuffFromCreature(creature, buff);
|
||||
}
|
||||
@@ -820,7 +822,7 @@ public class PlayerService implements INetworkDispatch {
|
||||
String xpType = ((player.getProfession().contains("entertainer")) ? "entertainer" : ((player.getProfession().contains("trader")) ? "crafting" : "combat_general"));
|
||||
|
||||
player.setXp(xpType, 0);
|
||||
creature.setXpBarValue(0);
|
||||
creature.setDisplayXp(0);
|
||||
|
||||
player.setProfessionWheelPosition("");
|
||||
|
||||
@@ -876,7 +878,7 @@ public class PlayerService implements INetworkDispatch {
|
||||
String xpType = ((player.getProfession().contains("entertainer")) ? "entertainer" : ((player.getProfession().contains("trader")) ? "crafting" : "combat_general"));
|
||||
|
||||
player.setXp(xpType, experience);
|
||||
creature.setXpBarValue(experience);
|
||||
creature.setDisplayXp(experience);
|
||||
|
||||
|
||||
// 2. Add the relevant health/action and expertise points.
|
||||
@@ -1061,7 +1063,7 @@ public class PlayerService implements INetworkDispatch {
|
||||
experience += ((experience * experienceBonus) / 100);
|
||||
|
||||
// 1. Add the experience.
|
||||
if (experience > 0 && !creature.isStationary()) {
|
||||
if (experience > 0 && !creature.isPerforming()) {
|
||||
creature.showFlyText(OutOfBand.ProsePackage("@base_player:prose_flytext_xp", experience), 2.5f, new RGB(180, 60, 240), 1, true);
|
||||
}
|
||||
|
||||
@@ -1072,7 +1074,7 @@ public class PlayerService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
player.setXp(xpType, experience);
|
||||
creature.setXpBarValue(experience);
|
||||
creature.setDisplayXp(experience);
|
||||
|
||||
// 2. See if they need to level up.
|
||||
for (int i = 0; i < experienceTable.getRowCount(); i++) {
|
||||
@@ -1453,8 +1455,8 @@ public class PlayerService implements INetworkDispatch {
|
||||
actor.sendSystemMessage("@unity:decline", (byte) 0);
|
||||
proposer.sendSystemMessage("@unity:declined", (byte) 0);
|
||||
actor.setAttachment("proposer", null);
|
||||
for(Long objId : proposer.getEquipmentList()) {
|
||||
SWGObject obj = core.objectService.getObject(objId);
|
||||
for(Equipment equipment : proposer.getEquipmentList()) {
|
||||
SWGObject obj = core.objectService.getObject(equipment.getObjectId());
|
||||
if(obj != null && obj.getAttachment("unity") != null) {
|
||||
obj.setAttachment("unity", null);
|
||||
break;
|
||||
|
||||
@@ -407,7 +407,7 @@ public class SkillService implements INetworkDispatch {
|
||||
List<String> skills = new ArrayList<String>(creature.getSkills());
|
||||
skills.stream().filter(s -> s.contains("expertise")).forEach(s -> removeSkill(creature, s));
|
||||
|
||||
creature.getBuffList().stream().forEach(buff -> creature.removeBuff(buff));
|
||||
creature.getBuffList().values().stream().forEach(buff -> creature.removeBuff(buff));
|
||||
}
|
||||
|
||||
public void sendRespecWindow(CreatureObject creature) {
|
||||
|
||||
@@ -185,7 +185,7 @@ public class AIActor {
|
||||
try {
|
||||
if (AIactive){
|
||||
// this is difficult, should NPC not fight when no player is near? || creature.getObservers().isEmpty()
|
||||
if(creature == null || creature.getFactionStatus()!=FactionStatus.Combatant || creature.isInCombat())
|
||||
if(creature == null || creature.getFactionStatus()!=FactionStatus.Combatant || creature.getObservers().isEmpty() || creature.isInCombat())
|
||||
return;
|
||||
if(this.getFollowObject() != null){ // Don't search if actor has valid target
|
||||
CreatureObject addedCreature = null;
|
||||
|
||||
@@ -122,7 +122,7 @@ public class LairActor {
|
||||
break;
|
||||
case 3:
|
||||
if (bossTemplate!=null && ! bossSpawned){
|
||||
CreatureObject boss = (CreatureObject)NGECore.getInstance().spawnService.spawnCreature(bossTemplate, lairObject.getPlanet().getName(), 0L, lairObject.getPosition().x + 3, lairObject.getPosition().y, lairObject.getPosition().z, lairObject.getOrientation().w, lairObject.getOrientation().x, lairObject.getOrientation().y,lairObject.getOrientation().z,-1);
|
||||
//CreatureObject boss = (CreatureObject)NGECore.getInstance().spawnService.spawnCreature(bossTemplate, lairObject.getPlanet().getName(), 0L, lairObject.getPosition().x + 3, lairObject.getPosition().y, lairObject.getPosition().z, lairObject.getOrientation().w, lairObject.getOrientation().x, lairObject.getOrientation().y,lairObject.getOrientation().z,-1);
|
||||
bossSpawned = true;
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -195,14 +195,16 @@ public class AttackState extends AIState {
|
||||
|
||||
if (target instanceof CreatureObject){
|
||||
CreatureObject targetCreature = (CreatureObject) target;
|
||||
if(targetCreature.getPosture() == 13 || targetCreature.getPosture() == 14 || targetCreature.isInStealth()) {
|
||||
if(targetCreature.getPosture() == 13 || targetCreature.getPosture() == 14 || targetCreature.isCloaked()) {
|
||||
|
||||
actor.setFollowObject(actor.getHighestDamageDealer());
|
||||
target = (CreatureObject) actor.getFollowObject();
|
||||
if(target == null)
|
||||
{
|
||||
creature.setLookAtTarget(0);
|
||||
creature.setIntendedTarget(0);
|
||||
if (creature.getLookAtTarget() != 0) {
|
||||
creature.setLookAtTarget(0);
|
||||
creature.setIntendedTarget(0);
|
||||
}
|
||||
|
||||
}
|
||||
actor.setFollowObject(null);
|
||||
|
||||
@@ -139,7 +139,7 @@ public class TurretAttackState extends TurretAIState {
|
||||
|
||||
if (target instanceof CreatureObject){
|
||||
CreatureObject targetCreature = (CreatureObject) target;
|
||||
if(targetCreature.getPosture() == 13 || targetCreature.getPosture() == 14 || targetCreature.isInStealth()) {
|
||||
if(targetCreature.getPosture() == 13 || targetCreature.getPosture() == 14 || targetCreature.isCloaked()) {
|
||||
|
||||
actor.setFollowObject(actor.getHighestDamageDealer());
|
||||
target = (CreatureObject) actor.getFollowObject();
|
||||
|
||||
@@ -906,11 +906,11 @@ public class CombatService implements INetworkDispatch {
|
||||
|
||||
private boolean attemptCombat(CreatureObject attacker, TangibleObject target) {
|
||||
|
||||
if (attacker.isInStealth()) {
|
||||
attacker.setInStealth(false);
|
||||
if (attacker.isCloaked()) {
|
||||
attacker.setCloaked(false);
|
||||
|
||||
if (attacker.getPlayerObject() != null && attacker.getPlayerObject().getProfession().equals("spy_1a")) {
|
||||
attacker.setRadarVisible(true);
|
||||
attacker.setVisibleOnRadar(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,6 @@ package services.command;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Map;
|
||||
@@ -36,7 +34,6 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import main.NGECore;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
import org.apache.mina.core.session.IoSession;
|
||||
|
||||
@@ -80,8 +77,9 @@ public class CommandService implements INetworkDispatch {
|
||||
if (actor == null)
|
||||
return false;
|
||||
|
||||
if (actor.getClient() == null)
|
||||
return false;
|
||||
// if (actor.getClient() == null)
|
||||
// return false;
|
||||
// Please consider that AI is calling callCommand too. Thank you.
|
||||
|
||||
if (command == null)
|
||||
return false;
|
||||
@@ -95,6 +93,7 @@ public class CommandService implements INetworkDispatch {
|
||||
if (actor.hasCooldown(command.getCooldownGroup()) || actor.hasCooldown(command.getCommandName()))
|
||||
return false;
|
||||
|
||||
|
||||
// Causes this service method to return with false after equipping a rifle, not allowing to unequip it anymore
|
||||
// because the client seems to consider rifles invalidweapons for an unkown reason
|
||||
|
||||
@@ -115,7 +114,7 @@ public class CommandService implements INetworkDispatch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (command.getTargetType()) {
|
||||
case 0: // Target Not Used For This Command
|
||||
break;
|
||||
@@ -251,7 +250,7 @@ public class CommandService implements INetworkDispatch {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
switch (command.getTarget()) {
|
||||
case 0: // Ally Only
|
||||
if (target == null) {
|
||||
@@ -318,7 +317,7 @@ public class CommandService implements INetworkDispatch {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(command instanceof CombatCommand) {
|
||||
try {
|
||||
processCommand(actor, target, (BaseSWGCommand) command.clone(), actionCounter, commandArgs);
|
||||
@@ -534,6 +533,7 @@ public class CommandService implements INetworkDispatch {
|
||||
|
||||
TangibleObject targetObject = (TangibleObject) target;
|
||||
|
||||
// FIXME Attacks will work on allies without this
|
||||
// if (!targetObject.isAttackableBy(actor)) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.python.core.Py;
|
||||
import org.python.core.PyObject;
|
||||
|
||||
import engine.resources.objects.SWGObject;
|
||||
import resources.equipment.Equipment;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
|
||||
public class BonusSetTemplate
|
||||
@@ -55,9 +56,9 @@ public class BonusSetTemplate
|
||||
public int getWornTemplateCount(CreatureObject creature)
|
||||
{
|
||||
int wornItems = 0;
|
||||
for (Long itemId : creature.getEquipmentList().get())
|
||||
for (Equipment equipment : creature.getEquipmentList().get())
|
||||
{
|
||||
SWGObject item = NGECore.getInstance().objectService.getObject(itemId);
|
||||
SWGObject item = NGECore.getInstance().objectService.getObject(equipment.getObjectId());
|
||||
if(item == null)
|
||||
continue;
|
||||
if(requiredWornItems.contains(item.getTemplate()) || requiredWornItems.contains(item.getStfName())) wornItems++;
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.python.core.Py;
|
||||
import org.python.core.PyObject;
|
||||
|
||||
import resources.datatables.FactionStatus;
|
||||
import resources.equipment.Equipment;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import main.NGECore;
|
||||
import engine.resources.container.Traverser;
|
||||
@@ -324,9 +325,9 @@ public class EquipmentService implements INetworkDispatch {
|
||||
int wornArmourPieces = 0, forceProtection = 0;
|
||||
Map<String, Float> protection = new TreeMap<String, Float>();
|
||||
|
||||
for(Long itemId : new ArrayList<Long>(creature.getEquipmentList()))
|
||||
for(Equipment equipment : new ArrayList<Equipment>(creature.getEquipmentList()))
|
||||
{
|
||||
SWGObject item = core.objectService.getObject(itemId);
|
||||
SWGObject item = core.objectService.getObject(equipment.getObjectId());
|
||||
if(item == null)
|
||||
continue;
|
||||
Map<String, Object> attributes = new TreeMap<String, Object>(item.getAttributes());
|
||||
|
||||
@@ -41,7 +41,7 @@ import protocol.swg.CommPlayerMessage;
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
import protocol.swg.PlayClientEffectObjectTransformMessage;
|
||||
import protocol.swg.objectControllerObjects.NpcConversationMessage;
|
||||
import protocol.swg.objectControllerObjects.QuestTaskTimerMessage;
|
||||
import protocol.swg.objectControllerObjects.QuestTaskCounterMessage;
|
||||
import resources.common.OutOfBand;
|
||||
import resources.common.SpawnPoint;
|
||||
import resources.datatables.FactionStatus;
|
||||
|
||||
@@ -897,8 +897,8 @@ public class HousingService implements INetworkDispatch {
|
||||
// possibly sending the same delta multiple times
|
||||
if (((CreatureObject) owner).getLookAtTarget() != itemList.get(i).getObjectID());
|
||||
((CreatureObject)owner).setLookAtTarget(itemList.get(i).getObjectID());
|
||||
if (((CreatureObject) owner).getTargetId() != itemList.get(i).getObjectID());
|
||||
((CreatureObject)owner).setTargetId(itemList.get(i).getObjectID());
|
||||
if (((CreatureObject) owner).getIntendedTarget() != itemList.get(i).getObjectID());
|
||||
((CreatureObject)owner).setIntendedTarget(itemList.get(i).getObjectID());
|
||||
if (((CreatureObject) owner).getIntendedTarget() != itemList.get(i).getObjectID());
|
||||
((CreatureObject)owner).setIntendedTarget(itemList.get(i).getObjectID());
|
||||
}
|
||||
|
||||
@@ -1040,48 +1040,63 @@ public class ObjectService implements INetworkDispatch {
|
||||
long objectId = selectCharacter.getCharacterId();
|
||||
Client client = core.getClient(session);
|
||||
if(client == null) {
|
||||
System.out.println("NULL Client");
|
||||
System.err.println("NULL Client");
|
||||
return;
|
||||
}
|
||||
CreatureObject creature = null;
|
||||
if(getObject(objectId) == null) {
|
||||
creature = getCreatureFromDB(objectId);
|
||||
if(creature == null) {
|
||||
System.out.println("Cant get creature from db");
|
||||
System.err.println("Cant get creature from db");
|
||||
} else {
|
||||
if (creature.getCustomName() == null || creature.getCustomName().isEmpty()) {
|
||||
System.err.println("Name: " + creature.getCustomName());
|
||||
System.out.println("Player with ObjID of " + creature.getObjectID() + " tried logging in but has a null/empty name!");
|
||||
System.err.println("Player with ObjID of " + creature.getObjectID() + " tried logging in but has a null/empty name!");
|
||||
return;
|
||||
} else {
|
||||
System.out.println("SelectCharacter: not in object list");
|
||||
System.err.println("SelectCharacter: not in object list");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (!(getObject(objectId) instanceof CreatureObject))
|
||||
if (!(getObject(objectId) instanceof CreatureObject)) {
|
||||
System.out.println("Character is not an instance of CreatureObject!");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
creature = (CreatureObject) getObject(objectId);
|
||||
if (creature.getCustomName() == null || creature.getCustomName().isEmpty()) {
|
||||
System.err.println("Creature's custom name was null/empty! Name: " + creature.getCustomName());
|
||||
}
|
||||
if(creature.getAttachment("disconnectTask") != null && creature.getClient() != null && !creature.getClient().getSession().isClosing())
|
||||
return;
|
||||
|
||||
if(creature.getAttachment("disconnectTask") != null)
|
||||
((ScheduledFuture<?>)creature.getAttachment("disconnectTask")).cancel(true);
|
||||
if (creature.getClient() != null) {
|
||||
if (!creature.getClient().getSession().isClosing()) {
|
||||
System.err.println("Character is already disconnecting...");
|
||||
return;
|
||||
}
|
||||
creature.setClient(null);
|
||||
}
|
||||
}
|
||||
if(creature.getAttachment("disconnectTask") != null) {
|
||||
((ScheduledFuture<?>) creature.getAttachment("disconnectTask")).cancel(true);
|
||||
}
|
||||
|
||||
PlayerObject ghost = (PlayerObject) creature.getSlottedObject("ghost");
|
||||
|
||||
if(ghost == null)
|
||||
|
||||
if (ghost == null) {
|
||||
System.err.println("The Character's Ghost is null!");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Character '" + creature.getCustomName() + "' now zoning...");
|
||||
|
||||
ghost.clearFlagBitmask(PlayerFlags.LD);
|
||||
|
||||
final CreatureObject finalCreature = creature;
|
||||
creature.viewChildren(creature, true, false, new Traverser() {
|
||||
public void process(SWGObject object) {
|
||||
finalCreature.makeUnaware(object);
|
||||
}
|
||||
});
|
||||
creature.getAwareObjects().removeAll(creature.getAwareObjects());
|
||||
creature.setAttachment("disconnectTask", null);
|
||||
|
||||
@@ -1090,6 +1105,8 @@ public class ObjectService implements INetworkDispatch {
|
||||
creature.setPlanet(planet);
|
||||
client.setParent(creature);
|
||||
|
||||
session.setAttribute("CmdSceneReady", false);
|
||||
|
||||
objectList.put(creature.getObjectID(), creature);
|
||||
|
||||
creature.viewChildren(creature, true, true, (object) -> {
|
||||
|
||||
@@ -438,7 +438,7 @@ public class MountService implements INetworkDispatch {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rider.isInStealth()) {
|
||||
if (rider.isCloaked()) {
|
||||
rider.sendSystemMessage(OutOfBand.ProsePackage("@pet/pet_menu:no_mount_stealth"), DisplayType.Broadcast);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ public class PetService implements INetworkDispatch {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rider.isInStealth()) {
|
||||
if (rider.isCloaked()) {
|
||||
rider.sendSystemMessage(OutOfBand.ProsePackage("@pet/pet_menu:no_mount_stealth"), DisplayType.Broadcast);
|
||||
return;
|
||||
}
|
||||
@@ -763,7 +763,7 @@ public class PetService implements INetworkDispatch {
|
||||
AIActor aiActor = (AIActor) mount.getAttachment("AI");
|
||||
aiActor.destroyActor();
|
||||
player.setPet(0L);
|
||||
owner.setCalledPet(null);
|
||||
owner.setCalledPet(null);
|
||||
core.objectService.destroyObject((Long) pcd.getAttachment("companion_RefId"));
|
||||
pcd.setAttachment("companion_RefId", null);
|
||||
}
|
||||
@@ -989,11 +989,11 @@ public class PetService implements INetworkDispatch {
|
||||
datapad.add(pcd);
|
||||
|
||||
if (target.getOption(Options.AGGRESSIVE))
|
||||
target.removeOption(Options.AGGRESSIVE);
|
||||
target.setOptions(Options.AGGRESSIVE, false);
|
||||
|
||||
target.setAttachment("tamed", 1);
|
||||
|
||||
actor.setCalledPet(target);
|
||||
actor.setCalledPet(target);
|
||||
target.setFaction(actor.getFaction());
|
||||
target.setFactionStatus(actor.getFactionStatus());
|
||||
target.setOwnerId(actor.getObjectID());
|
||||
|
||||
@@ -33,12 +33,14 @@ import protocol.swg.CommPlayerMessage;
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
import protocol.swg.PlayMusicMessage;
|
||||
import protocol.swg.objectControllerObjects.ForceActivateQuest;
|
||||
import protocol.swg.objectControllerObjects.QuestTaskCounterMessage;
|
||||
import protocol.swg.objectControllerObjects.QuestTaskTimerMessage;
|
||||
import protocol.swg.objectControllerObjects.ShowLootBox;
|
||||
import resources.common.ObjControllerOpcodes;
|
||||
import resources.common.OutOfBand;
|
||||
import resources.common.ProsePackage;
|
||||
import resources.datatables.DisplayType;
|
||||
import resources.objects.SWGList;
|
||||
import resources.objects.SWGMap;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
@@ -84,17 +86,12 @@ public class QuestService implements INetworkDispatch {
|
||||
catch (Exception e) {e.printStackTrace();}
|
||||
}
|
||||
|
||||
SWGList<Quest> questJournal = ghost.getQuestJournal();
|
||||
SWGMap<Integer, Quest> questJournal = ghost.getQuestJournal();
|
||||
|
||||
if (questJournal.size() == 0)
|
||||
return false;
|
||||
|
||||
for (Quest quest : questJournal) {
|
||||
if (quest.getName().equals(questName))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return questJournal.containsKey(CRC.StringtoCRC("quest/" + questName));
|
||||
}
|
||||
|
||||
public boolean isQuestCompleted(CreatureObject creo, String questName) {
|
||||
@@ -105,17 +102,15 @@ public class QuestService implements INetworkDispatch {
|
||||
catch (Exception e) {e.printStackTrace();}
|
||||
}
|
||||
|
||||
SWGList<Quest> questJournal = ghost.getQuestJournal();
|
||||
SWGMap<Integer, Quest> questJournal = ghost.getQuestJournal();
|
||||
|
||||
if (questJournal.size() == 0)
|
||||
return false;
|
||||
|
||||
for (Quest quest : questJournal) {
|
||||
if (quest.getName().equals(questName))
|
||||
return quest.isCompleted();
|
||||
}
|
||||
|
||||
return false;
|
||||
if (!questJournal.containsKey(CRC.StringtoCRC("quest/" + questName)))
|
||||
return false;
|
||||
else
|
||||
return questJournal.get(CRC.StringtoCRC("quest/") + questName).isCompleted();
|
||||
}
|
||||
|
||||
public void sendQuestWindow(CreatureObject reciever, String questName) {
|
||||
@@ -128,13 +123,15 @@ public class QuestService implements INetworkDispatch {
|
||||
|
||||
public void activateNextTask(CreatureObject quester, String questName) {
|
||||
|
||||
for (Quest quest : quester.getPlayerObject().getQuestJournal()) {
|
||||
if (quest.getName().equals(questName) && !quest.isCompleted())
|
||||
activateNextTask(quester, quest);
|
||||
if (quester.getPlayerObject().getQuestJournal().containsKey(CRC.StringtoCRC("quest/" + questName)) && !quester.getPlayerObject().getQuestJournal().get(CRC.StringtoCRC("quest/" + questName)).isCompleted()) {
|
||||
activateNextTask(quester, quester.getPlayerObject().getQuestJournal().get(CRC.StringtoCRC("quest/" + questName)));
|
||||
}
|
||||
}
|
||||
|
||||
public void activateNextTask(CreatureObject quester, Quest quest) {
|
||||
if (quester == null || quester.getClient() == null || quester.getClient().getSession() == null)
|
||||
return;
|
||||
|
||||
QuestData qData = getQuestData(quest.getName());
|
||||
|
||||
if (qData == null)
|
||||
@@ -167,33 +164,42 @@ public class QuestService implements INetworkDispatch {
|
||||
|
||||
// quest.task.ground.retrieve_item
|
||||
case "retrieve_item":
|
||||
String template = task.getServerTemplate();
|
||||
player.getQuestRetrieveItemTemplates().put(template, new QuestItem(quest.getName(), activeStep));
|
||||
player.getQuestRetrieveItemTemplates().put(task.getServerTemplate(), new QuestItem(quest.getName(), activeStep));
|
||||
|
||||
// TODO: add item count
|
||||
ObjControllerMessage itemCount = new ObjControllerMessage(11, new QuestTaskCounterMessage(quester.getObjectID(), quest.getCrcName(), "@quest/groundquests:retrieve_item_counter"));
|
||||
quester.getClient().getSession().write(itemCount.serialize());
|
||||
break;
|
||||
|
||||
case "timer":
|
||||
ObjControllerMessage timer = new ObjControllerMessage(11, new QuestTaskTimerMessage(quester.getObjectID(), quest.getCrcName(), "@quest/groundquests:timer_timertext", 20));
|
||||
quester.getClient().getSession().write(timer.serialize());
|
||||
System.out.println("Sent timer.");
|
||||
break;
|
||||
|
||||
default:
|
||||
System.out.println("Don't know what to do for quest task: " + type);
|
||||
//System.out.println("Don't know what to do for quest task: " + type);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
//if (task.getGrantQuestOnComplete() != null && !task.getGrantQuestOnComplete().equals(""))
|
||||
//activateQuest(quester, task.getGrantQuestOnComplete());
|
||||
|
||||
if (activeStep + 1 >= qData.getTasks().size()) {
|
||||
QuestList listItem = questRewardMap.get(quest.getName());
|
||||
|
||||
if (listItem.isCompleteWhenTasksComplete())
|
||||
completeQuest(player, quest); // Should this be the Force Complete Quest packet sent instead?
|
||||
|
||||
completeQuest(player, quest); // Force complete packet sent if the quest isn't auto completed (window shows up, typical for exclusive reward items)
|
||||
/*else
|
||||
sendQuestCompleteWindow(quester, quest.getName());*/
|
||||
|
||||
if (task.getGrantQuestOnComplete() != null && !task.getGrantQuestOnComplete().equals(""))
|
||||
activateQuest(quester, task.getGrantQuestOnComplete());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (task.getGrantQuestOnComplete() != null && !task.getGrantQuestOnComplete().equals(""))
|
||||
activateQuest(quester, task.getGrantQuestOnComplete());
|
||||
|
||||
quest.incrementQuestStep(); // After handling the quest type, we can now increment the step
|
||||
|
||||
if (!task.isVisible()) {
|
||||
@@ -205,7 +211,6 @@ public class QuestService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
public void activateQuest(CreatureObject quester, String questString) {
|
||||
System.out.println("Activating quest: " + questString);
|
||||
Quest quest = new Quest(questString, quester.getObjectID());
|
||||
|
||||
PlayerObject player = quester.getPlayerObject();
|
||||
@@ -213,9 +218,9 @@ public class QuestService implements INetworkDispatch {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
QuestList info = questRewardMap.get(questString);
|
||||
QuestList info = questRewardMap.get(quest.getName());
|
||||
if (info == null) {
|
||||
info = getQuestListDatatable(questString);
|
||||
info = getQuestListDatatable(quest.getName());
|
||||
}
|
||||
|
||||
ProsePackage prose = new ProsePackage("@quest/ground/system_message:quest_received");
|
||||
@@ -225,7 +230,7 @@ public class QuestService implements INetworkDispatch {
|
||||
PlayMusicMessage music = new PlayMusicMessage("sound/ui_npe2_quest_received.snd", quester.getObjectID(), 0, true);
|
||||
quester.getClient().getSession().write(music.serialize());
|
||||
|
||||
player.getQuestJournal().add(quest);
|
||||
player.getQuestJournal().put(quest.getCrc(), quest);
|
||||
player.setActiveQuest(quest.getCrc());
|
||||
|
||||
activateNextTask(quester, quest);
|
||||
@@ -249,8 +254,13 @@ public class QuestService implements INetworkDispatch {
|
||||
if (inventory == null)
|
||||
return;
|
||||
|
||||
boolean rewardSound = false;
|
||||
|
||||
PlayMusicMessage completeSound = new PlayMusicMessage("sound/ui_npe2_quest_completed.snd", creo.getObjectID(), 0, true);
|
||||
creo.getClient().getSession().write(completeSound.serialize());
|
||||
|
||||
// TODO: Give other awards - exclusive loots, faction points
|
||||
// Recieving quest awards (faction, item, exp, credits) - http://youtu.be/-L7Rz1WpmGM?t=14m50s
|
||||
// Receiving quest awards (faction, item, exp, credits) - http://youtu.be/-L7Rz1WpmGM?t=14m50s
|
||||
|
||||
// Give quest items
|
||||
|
||||
@@ -260,6 +270,7 @@ public class QuestService implements INetworkDispatch {
|
||||
recievedItems.add(rewardLoot.getObjectID());
|
||||
}
|
||||
|
||||
// TODO: Other item awards -- put above this comment
|
||||
if (recievedItems.size() != 0) {
|
||||
|
||||
for (long item : recievedItems) {
|
||||
@@ -268,26 +279,34 @@ public class QuestService implements INetworkDispatch {
|
||||
|
||||
ObjControllerMessage objMessage = new ObjControllerMessage(11, new ShowLootBox(creo.getObjectID(), recievedItems));
|
||||
creo.getClient().getSession().write(objMessage.serialize());
|
||||
|
||||
if (!rewardSound) {
|
||||
PlayMusicMessage itemSound = new PlayMusicMessage("sound/ui_npe2_quest_reward.snd", creo.getObjectID(), 0, true);
|
||||
creo.getClient().getSession().write(itemSound.serialize());
|
||||
rewardSound = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Give credits
|
||||
if (info.getRewardBankCredits() != 0) {
|
||||
creo.addBankCredits(info.getRewardBankCredits());
|
||||
creo.sendSystemMessage(OutOfBand.ProsePackage("@base_player:prose_transfer_success", "DI", info.getRewardBankCredits()), DisplayType.Broadcast);
|
||||
|
||||
if (!rewardSound) {
|
||||
PlayMusicMessage credSound = new PlayMusicMessage("sound/ui_npe2_quest_credits.snd", creo.getObjectID(), 0, true);
|
||||
creo.getClient().getSession().write(credSound.serialize());
|
||||
rewardSound = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Give experience - TODO: Give specific type of experience.
|
||||
if (info.getRewardExperienceAmount() == 0 && info.getTier() != -1 && !(info.getTier() > 6)) {
|
||||
if (info.getRewardExperienceAmount() != 0 && info.getTier() != -1 && !(info.getTier() > 6)) {
|
||||
int experienceAward = 0;
|
||||
try {
|
||||
DatatableVisitor experienceVisitor = ClientFileManager.loadFile("clientdata/datatables/quest/quest_experience", DatatableVisitor.class);
|
||||
DatatableVisitor experienceVisitor = ClientFileManager.loadFile("datatables/quest/quest_experience", DatatableVisitor.class);
|
||||
|
||||
for (int r = 0; r < experienceVisitor.getRowCount(); r++) {
|
||||
if ((int) experienceVisitor.getObject(r, 0) == creo.getLevel()) {
|
||||
|
||||
if (info.getTier() > 6 || info.getTier() == -1)
|
||||
return;
|
||||
|
||||
experienceAward = (int) experienceVisitor.getObject(r, info.getTier());
|
||||
}
|
||||
}
|
||||
@@ -297,7 +316,7 @@ public class QuestService implements INetworkDispatch {
|
||||
} else {
|
||||
core.playerService.giveExperience(creo, info.getRewardExperienceAmount());
|
||||
}
|
||||
|
||||
|
||||
// Update quest & client
|
||||
quest.setRecievedAward(true);
|
||||
creo.getClient().getSession().write(player.getBaseline(8).createDelta(7));
|
||||
@@ -321,7 +340,7 @@ public class QuestService implements INetworkDispatch {
|
||||
if (player.getQuestRetrieveItemTemplates().size() == 0)
|
||||
return radialName;
|
||||
|
||||
if (!player.hasRetrieveItemTemplate(template))
|
||||
if (!player.getQuestRetrieveItemTemplates().containsKey(template))
|
||||
return radialName;
|
||||
|
||||
QuestItem item = player.getQuestRetrieveItemTemplates().get(template);
|
||||
@@ -338,18 +357,14 @@ public class QuestService implements INetworkDispatch {
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!player.hasRetrieveItemTemplate(target.getTemplate())) {
|
||||
System.out.println("Player doesn't have the template: " + target.getTemplate());
|
||||
if (!player.getQuestRetrieveItemTemplates().containsKey(target.getTemplate()))
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QuestItem item = player.getQuestRetrieveItemTemplates().get(target.getTemplate());
|
||||
activateNextTask(quester, item.getQuestName());
|
||||
|
||||
|
||||
player.getQuestRetrieveItemTemplates().remove(target.getTemplate(), item);
|
||||
|
||||
if (player.hasRetrieveItemTemplate(target.getTemplate()))
|
||||
System.out.println("STILL HAS TEMPLATE!!");
|
||||
}
|
||||
|
||||
public QuestData getQuestData(String questName) {
|
||||
@@ -370,7 +385,6 @@ public class QuestService implements INetworkDispatch {
|
||||
if (questRewardMap.containsKey(questName))
|
||||
return questRewardMap.get(questName);
|
||||
else {
|
||||
System.out.println("Doesn't have it. Getting it from the list...");
|
||||
QuestList list = getQuestListDatatable(questName); // parsing puts it in quest map
|
||||
questRewardMap.put(questName, list);
|
||||
return list;
|
||||
|
||||
@@ -329,8 +329,8 @@ public class TravelService implements INetworkDispatch {
|
||||
|
||||
Planet planet = core.terrainService.getPlanetByName(tp.getPlanetName());
|
||||
Point3D spawnLocation = SpawnPoint.getRandomPosition(tp.getLocation(), 5, 20, actor.getPlanetId());
|
||||
core.simulationService.transferToPlanet(actor, planet, spawnLocation, new Quaternion(0, 0, 0, 0), null);
|
||||
|
||||
float positionY = core.terrainService.getHeight(actor.getPlanetId(), spawnLocation.x, spawnLocation.z);
|
||||
core.simulationService.transferToPlanet(actor, planet, new Point3D(spawnLocation.x, positionY, spawnLocation.z), new Quaternion(0, 0, 0, 0), null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user