diff --git a/scripts/buffs/buildabuff_inspiration.py b/scripts/buffs/buildabuff_inspiration.py new file mode 100644 index 00000000..30e7a75c --- /dev/null +++ b/scripts/buffs/buildabuff_inspiration.py @@ -0,0 +1,7 @@ +import sys + +def setup(core, actor, buff): + return + +def removeBuff(core, actor, buff): + return \ No newline at end of file diff --git a/scripts/commands/inspire.py b/scripts/commands/inspire.py index 59aede34..495c193f 100644 --- a/scripts/commands/inspire.py +++ b/scripts/commands/inspire.py @@ -6,8 +6,12 @@ def setup(): return def run(core, actor, target, commandString): - print ('Buffing Player: ' + str(target.getObjectId())) + print ('Buffing Player: ' + str(target.getObjectId()) + ' or: ' + target.getCustomName()) openBuffWindow = BuffBuilderStartMessage(actor.getObjectId(), actor.getObjectId(), target.getObjectId()) objController = ObjControllerMessage(11, openBuffWindow) actor.getClient().getSession().write(objController.serialize()) + + penBuffWindow = BuffBuilderStartMessage(target.getObjectId(), actor.getObjectId(), target.getObjectId()) + objController2 = ObjControllerMessage(11, penBuffWindow) + target.getClient().getSession().write(objController2.serialize()) return \ No newline at end of file diff --git a/src/main/NGECore.java b/src/main/NGECore.java index 7f3ceb47..728cd62a 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -33,6 +33,7 @@ import java.util.concurrent.ConcurrentHashMap; + import resources.common.RadialOptions; import resources.common.ThreadMonitor; import resources.objects.creature.CreatureObject; @@ -40,6 +41,7 @@ import services.AttributeService; import services.BuffService; import services.CharacterService; import services.ConnectionService; +import services.EntertainmentService; import services.EquipmentService; import services.GroupService; import services.LoginService; @@ -129,6 +131,7 @@ public class NGECore { public SkillModService skillModService; public EquipmentService equipmentService; public TravelService travelService; + public EntertainmentService entertainmentService; // Login Server public NetworkDispatch loginDispatch; @@ -198,6 +201,7 @@ public class NGECore { skillService = new SkillService(this); skillModService = new SkillModService(this); equipmentService = new EquipmentService(this); + entertainmentService = new EntertainmentService(this); // Ping Server @@ -227,6 +231,7 @@ public class NGECore { zoneDispatch.addService(travelService); zoneDispatch.addService(playerService); zoneDispatch.addService(buffService); + zoneDispatch.addService(entertainmentService); zoneServer = new MINAServer(zoneDispatch, config.getInt("ZONE.PORT")); zoneServer.start(); diff --git a/src/protocol/swg/OkMessage.java b/src/protocol/swg/OkMessage.java new file mode 100644 index 00000000..4c31f533 --- /dev/null +++ b/src/protocol/swg/OkMessage.java @@ -0,0 +1,29 @@ +package protocol.swg; + +import java.nio.ByteOrder; + +import org.apache.mina.core.buffer.IoBuffer; + +import resources.common.StringUtilities; + +public class OkMessage extends SWGMessage { + + public OkMessage() { + + } + + @Override + public void deserialize(IoBuffer data) { + + } + + @Override + public IoBuffer serialize() { + IoBuffer buffer = IoBuffer.allocate(6).order(ByteOrder.LITTLE_ENDIAN); + buffer.putShort((short) 1); + buffer.putInt(0xA16CF9AF); + System.out.println(StringUtilities.bytesToHex(buffer.array())); + return buffer.flip(); + } + +} diff --git a/src/protocol/swg/objectControllerObjects/BuffBuilderChange.java b/src/protocol/swg/objectControllerObjects/BuffBuilderChange.java deleted file mode 100644 index dcfb396c..00000000 --- a/src/protocol/swg/objectControllerObjects/BuffBuilderChange.java +++ /dev/null @@ -1,176 +0,0 @@ -package protocol.swg.objectControllerObjects; - -import java.io.UnsupportedEncodingException; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.util.Vector; - -import org.apache.mina.core.buffer.IoBuffer; - -import protocol.swg.ObjControllerMessage; -import resources.common.Console; -import resources.objects.BuffItem; - -public class BuffBuilderChange extends ObjControllerObject { - - private int buffCost; - private int accepted; - private int startTime; - private int tickCount; - - private long objectId; - private long bufferId; - private long recipientId; - - private byte unkByte; - - private Vector buffs = new Vector(); - - public BuffBuilderChange() { - - } - - public BuffBuilderChange(long objectId, long bufferId, long recipientId, int accepted, int cost, byte unkByte) { - this.objectId = objectId; - this.bufferId = bufferId; - this.recipientId = recipientId; - this.accepted = accepted; - this.buffCost = cost; - this.unkByte = unkByte; - } - - @Override - public void deserialize(IoBuffer data) { - objectId = data.getLong(); // acting players id - tickCount = data.getInt(); // tick count - bufferId = data.getLong(); // objId - recipientId = data.getLong(); - startTime = data.getInt(); - buffCost = data.getInt(); - accepted = data.getInt(); - unkByte = data.get(); - - int size = data.getInt(); // list size - for(int i = 0; i < size; i++) { - BuffItem buff = new BuffItem(); - int stringSize; - try { - stringSize = data.getShort(); - String buffName = new String(ByteBuffer.allocate(stringSize).put(data.array(), data.position(), size).array(), "US-ASCII"); - buff.setSkillName(buffName); - Console.println("Buff Name: " + buffName); - data.position(data.position() + size); - buff.setUnknown(data.getInt()); - Console.println("Buff Unknown: " + buff.getUnknown()); - buff.setAmount(data.getInt()); - Console.println("Buff Amount: " + buff.getAmount()); - buffs.add(buff); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - - } - - } - - @Override - public IoBuffer serialize() { - IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); - - result.putInt(ObjControllerMessage.BUFF_BUILDER_CHANGE); - result.putLong(objectId); - - result.putInt(tickCount); // tickCount - result.putLong(bufferId); - result.putLong(recipientId); - result.putInt(startTime); // starting time - result.putInt(buffCost); - result.putInt(accepted); - result.put(unkByte); // default 0 - - if (buffs == null || buffs.isEmpty()){ - result.putInt(0); - } else { - result.putInt(buffs.size()); - for (BuffItem buff : buffs) { - result.put(getAsciiString(buff.getSkillName())); - result.putInt(buff.getUnknown()); - result.putInt(buff.getAmount()); - } - } - - return result.flip(); - } - - public long getBufferId() { - return bufferId; - } - - public void setBufferId(long bufferId) { - this.bufferId = bufferId; - } - - public int getBuffCost() { - return buffCost; - } - - public void setBuffCost(int buffCost) { - this.buffCost = buffCost; - } - - public int getAccepted() { - return accepted; - } - - public void setAccepted(int accepted) { - this.accepted = accepted; - } - - public long getObjectId() { - return objectId; - } - - public void setObjectId(long objId) { - this.objectId = objId; - } - - public byte getUnkByte() { - return this.unkByte; - } - - public void setUnkByte(byte unkByte) { - this.unkByte = unkByte; - } - - public int getStartTime() { - return startTime; - } - - public void setStartTime(int startTime) { - this.startTime = startTime; - } - - public long getRecipientId() { - return recipientId; - } - - public void setRecipientId(long recipientId) { - this.recipientId = recipientId; - } - - public void setBuffs(Vector buffVector) { - this.buffs = buffVector; - } - - public Vector getBuffVector() { - return this.buffs; - } - - public int getTickCount() { - return tickCount; - } - - public void setTickCount(int tickCount) { - this.tickCount = tickCount; - } -} diff --git a/src/protocol/swg/objectControllerObjects/BuffBuilderChangeMessage.java b/src/protocol/swg/objectControllerObjects/BuffBuilderChangeMessage.java new file mode 100644 index 00000000..cbe6ce87 --- /dev/null +++ b/src/protocol/swg/objectControllerObjects/BuffBuilderChangeMessage.java @@ -0,0 +1,169 @@ +package protocol.swg.objectControllerObjects; + +import java.nio.ByteOrder; +import java.util.Vector; + +import org.apache.mina.core.buffer.IoBuffer; + +import protocol.swg.ObjControllerMessage; +import resources.common.ObjControllerOpcodes; +import resources.common.StringUtilities; +import resources.objects.BuffItem; + +public class BuffBuilderChangeMessage extends ObjControllerObject { + + private int buffCost; + private int time; + + private long objectId; + private long bufferId; + private long buffRecipientId; + + private boolean accepted; + private int buffRecipientAccepted; + + private Vector statBuffs = new Vector(); + + public BuffBuilderChangeMessage() { + + } + + public BuffBuilderChangeMessage(long objectId, long bufferId, long buffRecipientId, Vector statBuffs) { + this.objectId = objectId; + this.bufferId = bufferId; + this.buffRecipientId = buffRecipientId; + this.statBuffs = statBuffs; + } + + + @Override + public void deserialize(IoBuffer buffer) { + setObjectId(buffer.getLong()); + buffer.getInt(); + setBufferId(buffer.getLong()); + setBuffRecipientId(buffer.getLong()); + setTime(buffer.getInt()); + setBuffCost(buffer.getInt()); + + byte value = buffer.get(); + if (value == (byte) 0) + setAccepted(false); + else if (value == (byte) 1) + setAccepted(true); + + setBuffRecipientAccepted(buffer.getInt()); + + int statSize = buffer.getInt(); + for (int i = 0; i < statSize; i++) { + BuffItem item = new BuffItem(); + + String statName = getAsciiString(buffer); + item.setSkillName(statName); + + int investedPoints = buffer.getInt(); + item.setInvested(investedPoints); + + int maxAmount = buffer.getInt(); + item.setAmount(maxAmount); + + statBuffs.add(item); + } + } + + @Override + public IoBuffer serialize() { + IoBuffer result = IoBuffer.allocate(65 + statBuffs.size()).order(ByteOrder.LITTLE_ENDIAN); + result.setAutoExpand(true); + + result.putInt(ObjControllerMessage.BUFF_BUILDER_CHANGE); + result.putLong(objectId); + + result.putInt(0); + + result.putLong(bufferId); + result.putLong(buffRecipientId); + + result.putInt(time); + result.putInt(buffCost); + + result.put((byte) ((accepted) ? 1 : 0)); + result.putInt(buffRecipientAccepted); + + result.putInt(statBuffs.size()); + + if (!statBuffs.isEmpty()) { + for (BuffItem item : statBuffs) { + result.put(getAsciiString(item.getSkillName())); + result.putInt(item.getInvested()); + result.putInt(item.getAmount()); + } + } + + return result.flip(); + } + + public int getBuffCost() { + return buffCost; + } + + public void setBuffCost(int buffCost) { + this.buffCost = buffCost; + } + + public int getTime() { + return time; + } + + public void setTime(int time) { + this.time = time; + } + + public long getObjectId() { + return objectId; + } + + public void setObjectId(long objectId) { + this.objectId = objectId; + } + + public long getBufferId() { + return bufferId; + } + + public void setBufferId(long bufferId) { + this.bufferId = bufferId; + } + + public long getBuffRecipientId() { + return buffRecipientId; + } + + public void setBuffRecipientId(long buffRecipientId) { + this.buffRecipientId = buffRecipientId; + } + + public boolean getAccepted() { + return accepted; + } + + public void setAccepted(boolean accepted) { + this.accepted = accepted; + } + + public int getBuffRecipientAccepted() { + return buffRecipientAccepted; + } + + public void setBuffRecipientAccepted(int buffRecipientAccepted) { + this.buffRecipientAccepted = buffRecipientAccepted; + } + + public Vector getStatBuffs() { + return statBuffs; + } + + public void setStatBuffs(Vector statBuffs) { + this.statBuffs = statBuffs; + } + +} diff --git a/src/resources/common/BuffBuilder.java b/src/resources/common/BuffBuilder.java new file mode 100644 index 00000000..ac65eccb --- /dev/null +++ b/src/resources/common/BuffBuilder.java @@ -0,0 +1,58 @@ +package resources.common; + +public class BuffBuilder { + private String statName; + private String statAffects; + private int maxTimesApplied; + private int affectAmount; + private String requiredExperience; + + public BuffBuilder() { + + } + + public String getStatName() { + return statName; + } + + public void setStatName(String statName) { + this.statName = statName; + } + + public String getStatAffects() { + return statAffects; + } + + public void setStatAffects(String statAffects) { + this.statAffects = statAffects; + } + + public int getMaxTimesApplied() { + return maxTimesApplied; + } + + public void setMaxTimesApplied(int maxTimesApplied) { + this.maxTimesApplied = maxTimesApplied; + } + + public int getAffectAmount() { + return affectAmount; + } + + public void setAffectAmount(int affectAmount) { + this.affectAmount = affectAmount; + } + + public String getRequiredExperience() { + return requiredExperience; + } + + public void setRequiredExperience(String requiredExperience) { + this.requiredExperience = requiredExperience; + } + + public int getTotalAffected(int bonusAmount) { + int totalAffected = getMaxTimesApplied() + getAffectAmount(); + return totalAffected + bonusAmount; + } +} diff --git a/src/resources/objects/Buff.java b/src/resources/objects/Buff.java index c7ee85de..c0d0d9e3 100644 --- a/src/resources/objects/Buff.java +++ b/src/resources/objects/Buff.java @@ -22,6 +22,7 @@ package resources.objects; import java.nio.ByteOrder; +import java.util.Vector; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; @@ -31,6 +32,7 @@ import main.NGECore; import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.buffer.SimpleBufferAllocator; +import resources.common.BuffBuilder; import resources.objects.creature.CreatureObject; import com.sleepycat.persist.model.NotPersistent; @@ -67,6 +69,7 @@ public class Buff implements IListObject { @NotPersistent private ScheduledFuture removalTask; private int stacks = 1; + private Vector builtBuffs; public Buff(String buffName, long ownerId) { @@ -417,4 +420,12 @@ public class Buff implements IListObject { this.stacks = stacks; } + public Vector getBuiltBuffs() { + return builtBuffs; + } + + public void setBuiltBuffs(Vector builtBuffs) { + this.builtBuffs = builtBuffs; + } + } diff --git a/src/resources/objects/BuffItem.java b/src/resources/objects/BuffItem.java index a7eb3ab0..79e28b8a 100644 --- a/src/resources/objects/BuffItem.java +++ b/src/resources/objects/BuffItem.java @@ -23,17 +23,17 @@ package resources.objects; public class BuffItem { private String skillName; - private int unknown; - private int amount; + private int invested; + private int bonusAmount; // expertise bonus (50%*4 = 200) which would then result in bonusAmount + (maxTimesApplied * affectAmount) = result public BuffItem() { } - public BuffItem(String skillName, int unknown, int amount) { + public BuffItem(String skillName, int invested, int amount) { this.skillName = skillName; - this.unknown = unknown; - this.amount = amount; + this.invested = invested; + this.bonusAmount = amount; } public String getSkillName() { @@ -44,19 +44,19 @@ public class BuffItem { this.skillName = skillName; } - public int getUnknown() { - return unknown; + public int getInvested() { + return invested; } - public void setUnknown(int unknown) { - this.unknown = unknown; + public void setInvested(int invested) { + this.invested = invested; } public int getAmount() { - return amount; + return bonusAmount; } public void setAmount(int amount) { - this.amount = amount; + this.bonusAmount = amount; } } diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index 23307378..9baf46fa 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -101,7 +101,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { // CREO6 private byte combatFlag = 0; - private short level = 1; + private short level = 90; private int grantedHealth = 0; private String currentAnimation; private String moodAnimation; diff --git a/src/services/BuffService.java b/src/services/BuffService.java index 3012a962..8e28b62c 100644 --- a/src/services/BuffService.java +++ b/src/services/BuffService.java @@ -23,6 +23,7 @@ package services; import java.nio.ByteOrder; import java.util.Map; +import java.util.Vector; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; @@ -38,16 +39,18 @@ import java.util.concurrent.TimeUnit; + + import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; import protocol.swg.ObjControllerMessage; -import protocol.swg.objectControllerObjects.BuffBuilderChange; import protocol.swg.objectControllerObjects.BuffBuilderStartMessage; import resources.common.Console; import resources.common.FileUtilities; import resources.common.ObjControllerOpcodes; import resources.objects.Buff; +import resources.objects.BuffItem; import resources.objects.DamageOverTime; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; @@ -68,83 +71,7 @@ public class BuffService implements INetworkDispatch { @Override public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { - // BUFF_BUILDER_CHANGE sent every time something is clicked on in the Buff Builder. It's also sent when the buff session is started. - objControllerOpcodes.put(ObjControllerOpcodes.BUFF_BUILDER_CHANGE, new INetworkRemoteEvent() { - - @Override - public void handlePacket(IoSession session, IoBuffer data) throws Exception { - Console.println("BUFF_BUILDER_CHANGE RECIEVED"); - data.order(ByteOrder.LITTLE_ENDIAN); - - Client client = core.getClient((Integer) session.getAttribute("connectionId")); - - if(client == null) - return; - - SWGObject sender = client.getParent(); - - if(sender == null) - return; - - BuffBuilderChange changeMessage = new BuffBuilderChange(); - changeMessage.deserialize(data); - - SWGObject recipient = core.objectService.getObject(changeMessage.getRecipientId()); - - if (recipient == null || recipient.getClient() == null) - return; - - if (sender.getClient().getSession().containsAttribute("buffWorkshop")) { - - long attribute = (long) sender.getClient().getSession().getAttribute("buffWorkshop"); - Console.println("Sender Attribute = " + attribute); - Console.println("Recipient ID (Packet) = " + changeMessage.getRecipientId()); - - if (attribute == changeMessage.getObjectId()) { - // TODO: accepted checked? give buff - Console.println("Buffer buffing themselves!"); - return; - } - - else if (attribute == changeMessage.getRecipientId() && attribute != changeMessage.getObjectId()) { - Console.println("Attribute check passed!"); // LAST TRIED BYTE 6 - BuffBuilderChange recievingMsg = new BuffBuilderChange(recipient.getObjectId(), changeMessage.getBufferId(), changeMessage.getRecipientId(), 0, changeMessage.getBuffCost(), (byte) 7); - recievingMsg.setStartTime(changeMessage.getStartTime()); - recievingMsg.setTickCount(changeMessage.getTickCount() + 1); - - ObjControllerMessage objRcController = new ObjControllerMessage(0x23, recievingMsg); - recipient.getClient().getSession().write(objRcController.serialize()); - Console.println("Msg sent to: " + recipient.getCustomName() + " that has an ID of: " + recipient.getObjectId()); - Console.println("ObjectId: " + recievingMsg.getObjectId()); - Console.println("BufferId: " + recievingMsg.getBufferId()); - Console.println("RecipientId: " + recievingMsg.getRecipientId()); - Console.println("Buff Cost: " + recievingMsg.getBuffCost()); - Console.println("MessageRecipientId: " + recievingMsg.getRecipientId()); - - Console.println("BYTE: " + recievingMsg.getUnkByte()); - - } - - } else { - - // Don't need a Buff Recipient Window for buffing themselves.. - if (changeMessage.getObjectId() == changeMessage.getRecipientId()) { - sender.getClient().getSession().setAttribute("buffWorkshop", recipient.getObjectId()); - Console.println("Sender attribute set to: " + sender.getClient().getSession().getAttribute("buffWorkshop").toString()); - return; - } - - BuffBuilderStartMessage startMsg = new BuffBuilderStartMessage(recipient.getObjectId(), sender.getObjectId(), recipient.getObjectId()); - ObjControllerMessage objController = new ObjControllerMessage(11, startMsg); - recipient.getClient().getSession().write(objController.serialize()); - - recipient.getClient().getSession().setAttribute("buffWorkshop", changeMessage.getObjectId()); - Console.println("Recipient attribute set to: " + recipient.getClient().getSession().getAttribute("buffWorkshop").toString()); - sender.getClient().getSession().setAttribute("buffWorkshop", recipient.getObjectId()); - Console.println("Sender attribute set to: " + sender.getClient().getSession().getAttribute("buffWorkshop").toString()); - } - } - }); + } @Override diff --git a/src/services/EntertainmentService.java b/src/services/EntertainmentService.java new file mode 100644 index 00000000..d01a0521 --- /dev/null +++ b/src/services/EntertainmentService.java @@ -0,0 +1,168 @@ +package services; + +import java.nio.ByteOrder; +import java.util.Map; +import java.util.Vector; +import java.util.concurrent.ConcurrentHashMap; + +import main.NGECore; + +import org.apache.mina.core.buffer.IoBuffer; +import org.apache.mina.core.session.IoSession; + +import protocol.swg.ObjControllerMessage; +import protocol.swg.OkMessage; +import protocol.swg.objectControllerObjects.BuffBuilderChangeMessage; +import protocol.swg.objectControllerObjects.BuffBuilderStartMessage; +import resources.common.BuffBuilder; +import resources.common.Console; +import resources.common.ObjControllerOpcodes; +import resources.objects.Buff; +import resources.objects.BuffItem; +import resources.objects.creature.CreatureObject; +import resources.objects.player.PlayerObject; +import engine.clientdata.ClientFileManager; +import engine.clientdata.visitors.DatatableVisitor; +import engine.clients.Client; +import engine.resources.objects.SWGObject; +import engine.resources.service.INetworkDispatch; +import engine.resources.service.INetworkRemoteEvent; + +public class EntertainmentService implements INetworkDispatch { + + private NGECore core; + + private Vector buffBuilderSkills = new Vector(); + + public EntertainmentService(NGECore core) { + this.core = core; + populateSkillCaps(); + } + + @Override + public void insertOpcodes(Map swgOpcodes, Map objControllerOpcodes) { + objControllerOpcodes.put(ObjControllerOpcodes.BUFF_BUILDER_CHANGE, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + Console.println("BUFF_BUILDER_CHANGE RECIEVED"); + data.order(ByteOrder.LITTLE_ENDIAN); + + Client client = core.getClient((Integer) session.getAttribute("connectionId")); + + if(client == null) + return; + + SWGObject sender = client.getParent(); + + if(sender == null) + return; + + BuffBuilderChangeMessage sentPacket = new BuffBuilderChangeMessage(); + sentPacket.deserialize(data); + + Vector statBuffs = sentPacket.getStatBuffs(); + + /*for (BuffItem item : statBuffs) { + System.out.println("Buff Name: " + item.getSkillName()); + System.out.println("Ents bonus to item: " + item.getAmount()); + }*/ + + SWGObject buffer = core.objectService.getObject(sentPacket.getBufferId()); + SWGObject buffRecipient = core.objectService.getObject(sentPacket.getBuffRecipientId()); + + Console.println("Packet Sender ID: " + sender.getObjectId()); + + if (buffer != buffRecipient) { + + BuffBuilderChangeMessage changeMessage = new BuffBuilderChangeMessage(); + changeMessage.setBuffCost(sentPacket.getBuffCost()); + changeMessage.setTime(sentPacket.getTime()); + changeMessage.setBufferId(buffer.getObjectId()); + changeMessage.setBuffRecipientId(buffRecipient.getObjectId()); + + if (!statBuffs.isEmpty()) + changeMessage.setStatBuffs(statBuffs); + + if (sentPacket.getAccepted() == true && sentPacket.getBuffRecipientAccepted() == 1) { + System.out.println("both accepted!"); + OkMessage closeMsg = new OkMessage(); + buffer.getClient().getSession().write(closeMsg.serialize()); + + // TODO: Give Buff + + } else if (sentPacket.getAccepted() == true && sentPacket.getBuffRecipientAccepted() == 0) { + changeMessage.setAccepted(true); + changeMessage.setObjectId(buffRecipient.getObjectId()); + + ObjControllerMessage objMsg = new ObjControllerMessage(0x0B, changeMessage); + buffRecipient.getClient().getSession().write(objMsg.serialize()); + } else { + changeMessage.setAccepted(false); + changeMessage.setObjectId(sentPacket.getBuffRecipientId()); + + ObjControllerMessage objMsg = new ObjControllerMessage(0x0B, changeMessage); + buffRecipient.getClient().getSession().write(objMsg.serialize()); + } + + } else { + + } + } + + }); + } + + private void populateSkillCaps() { + try { + DatatableVisitor buffBuilder = ClientFileManager.loadFile("datatables/buff/buff_builder.iff", DatatableVisitor.class); + + for (int r = 0; r < buffBuilder.getRowCount(); r++) { + String skillName = ((String) buffBuilder.getObject(r, 0)); + String statAffects = ((String) buffBuilder.getObject(r, 2)); + int maxTimes = ((int) buffBuilder.getObject(r, 3)); + int affectAmount = ((int) buffBuilder.getObject(r, 5)); + String requiredExperience = ((String) buffBuilder.getObject(r, 6)); + + BuffBuilder item = new BuffBuilder(); + item.setStatName(skillName); + item.setStatAffects(statAffects); + item.setMaxTimesApplied(maxTimes); + item.setAffectAmount(affectAmount); + item.setRequiredExperience(requiredExperience); + + buffBuilderSkills.add(item); + } + } catch (InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + } + } + + public void giveInspirationBuff(SWGObject buffer, SWGObject reciever, Vector buffVector) { + CreatureObject buffCreature = (CreatureObject) buffer; + + Vector availableSkills = buffBuilderSkills; + + Vector buffsToAdd = new Vector(); + + for (BuffItem item : buffVector) { + for (BuffBuilder builder : availableSkills) { + if (builder.getStatName().equals(item.getSkillName())) { + buffsToAdd.add(builder); + Console.println("Added buff item: " + builder.getStatName()); + break; + } + } + } + + //Buff builtBuff = new Buff("buildabuff_inspiration", reciever.getObjectId()); + core.buffService.addBuffToCreature(buffCreature, "buildabuff_inspiration"); + + } + + @Override + public void shutdown() { + + } + +}