mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-21 06:13:13 -04:00
Inspire Buff applies to Buff Recipient now
Don't know how to resolve these issues: Stat's aren't updating in character sheet correctly Time is not showing for buff.
This commit is contained in:
@@ -1,7 +1,25 @@
|
||||
from resources.common import BuffBuilder
|
||||
import sys
|
||||
|
||||
def setup(core, actor, buff):
|
||||
|
||||
buffWorkshop = actor.getAttachment('buffWorkshop')
|
||||
|
||||
if buffWorkshop is None:
|
||||
return
|
||||
|
||||
for BuffBuilder in buffWorkshop:
|
||||
core.skillModService.addSkillMod(actor, BuffBuilder.getStatAffects(), BuffBuilder.getTotalAffected())
|
||||
print (' gave the skill mod ' + BuffBuilder.getStatAffects() + ' with affect of ' + str(BuffBuilder.getTotalAffected()))
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def removeBuff(core, actor, buff):
|
||||
for BuffBuilder in actor.getAttachment('buffWorkshop'):
|
||||
core.skillModService.deductSkillMod(actor, BuffBuilder.getStatAffects(), BuffBuilder.getTotalAffected())
|
||||
print ('removed skill mod!')
|
||||
return
|
||||
|
||||
actor.setAttachment('buffWorkshop', 'none')
|
||||
return
|
||||
@@ -7,6 +7,8 @@ public class BuffBuilder {
|
||||
private int affectAmount;
|
||||
private String requiredExperience;
|
||||
|
||||
private int entBonus;
|
||||
|
||||
public BuffBuilder() {
|
||||
|
||||
}
|
||||
@@ -51,8 +53,16 @@ public class BuffBuilder {
|
||||
this.requiredExperience = requiredExperience;
|
||||
}
|
||||
|
||||
public int getTotalAffected(int bonusAmount) {
|
||||
public int getTotalAffected() {
|
||||
int totalAffected = getMaxTimesApplied() + getAffectAmount();
|
||||
return totalAffected + bonusAmount;
|
||||
return totalAffected + getEntBonus();
|
||||
}
|
||||
|
||||
public int getEntBonus() {
|
||||
return entBonus;
|
||||
}
|
||||
|
||||
public void setEntBonus(int entBonus) {
|
||||
this.entBonus = entBonus;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
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;
|
||||
@@ -69,7 +68,6 @@ public class Buff implements IListObject {
|
||||
@NotPersistent
|
||||
private ScheduledFuture<?> removalTask;
|
||||
private int stacks = 1;
|
||||
private Vector<BuffBuilder> builtBuffs;
|
||||
|
||||
public Buff(String buffName, long ownerId) {
|
||||
|
||||
@@ -420,12 +418,4 @@ public class Buff implements IListObject {
|
||||
this.stacks = stacks;
|
||||
}
|
||||
|
||||
public Vector<BuffBuilder> getBuiltBuffs() {
|
||||
return builtBuffs;
|
||||
}
|
||||
|
||||
public void setBuiltBuffs(Vector<BuffBuilder> builtBuffs) {
|
||||
this.builtBuffs = builtBuffs;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -89,12 +89,12 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
OkMessage closeMsg = new OkMessage();
|
||||
buffer.getClient().getSession().write(closeMsg.serialize());
|
||||
|
||||
// TODO: Give Buff
|
||||
giveInspirationBuff(buffRecipient, statBuffs);
|
||||
|
||||
} 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 {
|
||||
@@ -106,7 +106,12 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (sentPacket.getAccepted() == true) {
|
||||
OkMessage closeMsg = new OkMessage();
|
||||
buffer.getClient().getSession().write(closeMsg.serialize());
|
||||
|
||||
giveInspirationBuff(buffRecipient, statBuffs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,8 +143,8 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
}
|
||||
}
|
||||
|
||||
public void giveInspirationBuff(SWGObject buffer, SWGObject reciever, Vector<BuffItem> buffVector) {
|
||||
CreatureObject buffCreature = (CreatureObject) buffer;
|
||||
public void giveInspirationBuff(SWGObject reciever, Vector<BuffItem> buffVector) {
|
||||
CreatureObject buffCreature = (CreatureObject) reciever;
|
||||
|
||||
Vector<BuffBuilder> availableSkills = buffBuilderSkills;
|
||||
|
||||
@@ -148,14 +153,18 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
for (BuffItem item : buffVector) {
|
||||
for (BuffBuilder builder : availableSkills) {
|
||||
if (builder.getStatName().equals(item.getSkillName())) {
|
||||
builder.setEntBonus(item.getAmount());
|
||||
buffsToAdd.add(builder);
|
||||
Console.println("Added buff item: " + builder.getStatName());
|
||||
break;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Buff builtBuff = new Buff("buildabuff_inspiration", reciever.getObjectId());
|
||||
reciever.setAttachment("buffWorkshop", buffsToAdd);
|
||||
|
||||
core.buffService.addBuffToCreature(buffCreature, "buildabuff_inspiration");
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user