mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-13 03:13:26 -04:00
Fixed buff duration check, fixed group buffs
- The duration needed to be set on the buff object "before "the buff is actually added. Because of this, I made the distinction between setup(0 (setting up the buff object) and add() (adding the buff stats to the player). - Group buffs would add the buff based on each individual player's skillmods instead of the buffer's. Due to this, I made a "buffer" parameter for doAddBuff(). If there is a buffer, regardless of it's a buffer within our group, we can specify them, otherwise provide null.
This commit is contained in:
@@ -71,15 +71,17 @@ public class BuffService implements INetworkDispatch {
|
||||
if(buff.isGroupBuff()) {
|
||||
addGroupBuff(creature, buffName);
|
||||
} else {
|
||||
doAddBuff(creature, buffName);
|
||||
doAddBuff(creature, buffName, null);
|
||||
}
|
||||
}
|
||||
|
||||
public Buff doAddBuff(final CreatureObject creature, String buffName) {
|
||||
public Buff doAddBuff(final CreatureObject creature, String buffName, CreatureObject buffer) {
|
||||
|
||||
final Buff buff = new Buff(buffName, creature.getObjectID());
|
||||
buff.setTotalPlayTime(((PlayerObject) creature.getSlottedObject("ghost")).getTotalPlayTime());
|
||||
|
||||
if(FileUtilities.doesFileExist("scripts/buffs/" + buffName + ".py"))
|
||||
core.scriptService.callScript("scripts/buffs/", buffName, "setup", core, ((buffer == null) ? creature : buffer), buff);
|
||||
|
||||
for (final Buff otherBuff : creature.getBuffList()) {
|
||||
if (buff.getGroup1().equals(otherBuff.getGroup1()))
|
||||
@@ -110,7 +112,7 @@ public class BuffService implements INetworkDispatch {
|
||||
}
|
||||
|
||||
if(FileUtilities.doesFileExist("scripts/buffs/" + buffName + ".py"))
|
||||
core.scriptService.callScript("scripts/buffs/", buffName, "setup", core, creature, buff);
|
||||
core.scriptService.callScript("scripts/buffs/", buffName, "add", core, creature, buff);
|
||||
|
||||
creature.addBuff(buff);
|
||||
|
||||
@@ -153,6 +155,10 @@ public class BuffService implements INetworkDispatch {
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer != null && creature.getGroupId() != 0 && creature.getGroupId() == buffer.getGroupId()) {
|
||||
buff.setGroupBufferId(buffer.getObjectID());
|
||||
}
|
||||
|
||||
return buff;
|
||||
|
||||
}
|
||||
@@ -168,7 +174,7 @@ public class BuffService implements INetworkDispatch {
|
||||
creature.removeDot(dot);
|
||||
}
|
||||
if(FileUtilities.doesFileExist("scripts/buffs/" + buff.getBuffName() + ".py"))
|
||||
core.scriptService.callScript("scripts/buffs/", buff.getBuffName(), "removeBuff", core, creature, buff);
|
||||
core.scriptService.callScript("scripts/buffs/", buff.getBuffName(), "remove", core, creature, buff);
|
||||
creature.removeBuff(buff);
|
||||
|
||||
for (String effect : buff.getParticleEffect().split(",")) {
|
||||
@@ -215,20 +221,19 @@ public class BuffService implements INetworkDispatch {
|
||||
public void addGroupBuff(final CreatureObject buffer, String buffName) {
|
||||
|
||||
if(buffer.getGroupId() == 0) {
|
||||
doAddBuff(buffer, buffName);
|
||||
doAddBuff(buffer, buffName, null);
|
||||
return;
|
||||
}
|
||||
|
||||
GroupObject group = (GroupObject) core.objectService.getObject(buffer.getGroupId());
|
||||
|
||||
if(group == null) {
|
||||
doAddBuff(buffer, buffName);
|
||||
doAddBuff(buffer, buffName, null);
|
||||
return;
|
||||
}
|
||||
|
||||
for(SWGObject member : group.getMemberList()) {
|
||||
Buff buff = doAddBuff((CreatureObject) member, buffName);
|
||||
buff.setGroupBufferId(buffer.getObjectID());
|
||||
Buff buff = doAddBuff((CreatureObject) member, buffName, buffer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user