Added Inspiration ticks, effects for Multi-Tier Performance Abilities

(BugFix) Build-A-Buff applies correct stats now
-- NOTE: Stats that the player does not have yet may not show in
character sheet but the server will recognize still recognize their new
stats
(Added) Inspiration Ticks
(BugFix) Inspiration Buffs time corresponds to the players inspiration
ticks.
(BugFix) "Watch" on radial menu working again
(Added) Put in the effects for the multi-tiered performance abilities
(Feature) You can now type /[performance effect] [tier number] to use
that specific effect
(BugFix) showFlyText boolean for showing to observers or not (fixes
other players exp gain shown to other players)
(Code) Few minor additions/fixes
This commit is contained in:
Waverunner
2014-03-22 11:47:37 -04:00
parent ca4e0559a1
commit ffc9aec1b1
24 changed files with 242 additions and 69 deletions
+5 -2
View File
@@ -8,10 +8,13 @@ def setup(core, actor, buff):
if buffWorkshop is None:
return
buff.setDuration(3600) #1 hour
attached = actor.getAttachment('inspireDuration')
print (attached)
buff.setDuration(float(actor.getAttachment('inspireDuration') * 60))
print ('Buff Duration: ' + str(actor.getAttachment('inspireDuration')))
for BuffItem in buffWorkshop:
core.skillModService.addSkillMod(actor, BuffItem.getSkillName(), BuffItem.getAffectAmount())
print ('Gave skill mod ' + BuffItem.getSkillName() + ' with affect of ' + str(BuffItem.getAffectAmount()))
return
+13 -4
View File
@@ -6,14 +6,23 @@ def setup():
def run(core, actor, target, commandString):
command = 'ColorLights1'
effect = 'entertainer_color_lights_level_1.cef'
effect = 'clienteffect/entertainer_color_lights_level_1.cef'
rLevel = 4 # minimum level to perform this effect
if actor.getLevel() < 4:
if commandString == '2':
command = 'ColorLights2'
effect = 'clienteffect/entertainer_color_lights_level_2.cef'
rLevel = 20
elif commandString == '3':
command = 'ColorLights3'
effect = 'clienteffect/entertainer_color_lights_level_3.cef'
rLevel = 50
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
return
# TODO: Find out levels for other colored light 2 and 3
if core.entertainmentService.performEffect(actor, command, effect, target) is True:
actor.sendSystemMessage('@performance:effect_perform_color_lights', 0)
return
+13 -4
View File
@@ -6,14 +6,23 @@ def setup():
def run(core, actor, target, commandString):
command = 'Dazzle1'
effect = 'entertainer_dazzle_level_1.cef'
effect = 'clienteffect/entertainer_dazzle_level_1.cef'
rLevel = 10 # minimum level to perform this effect
if actor.getLevel() < 10:
if commandString == '2':
command = 'Dazzle2'
effect = 'clienteffect/entertainer_dazzle_level_2.cef'
rLevel = 20
elif commandString == '3':
command = 'Dazzle3'
effect = 'clienteffect/entertainer_dazzle_level_3.cef'
rLevel = 30
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
return
# TODO: Find out levels for other dazzle 2 and 3
if core.entertainmentService.performEffect(actor, command, effect, target) is True:
actor.sendSystemMessage('@performance:effect_perform_dazzle', 0)
return
+13 -4
View File
@@ -6,14 +6,23 @@ def setup():
def run(core, actor, target, commandString):
command = 'Distract1'
effect = 'entertainer_distract_level_1.cef'
effect = 'clienteffect/entertainer_distract_level_1.cef'
rLevel = 18 # minimum level to perform this effect
if actor.getLevel() < 18:
if commandString == '2':
command = 'Distract2'
effect = 'clienteffect/entertainer_distract_level_2.cef'
rLevel = 50
elif commandString == '3':
command = 'Distract3'
effect = 'clienteffect/entertainer_distract_level_3.cef'
rLevel = 75
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
return
# TODO: Find out levels for other distract 2 and 3
if core.entertainmentService.performEffect(actor, command, effect, target) is True:
actor.sendSystemMessage('@performance:effect_perform_distract', 0)
return
+14 -5
View File
@@ -6,14 +6,23 @@ def setup():
def run(core, actor, target, commandString):
command = 'FireJets1'
effect = 'entertainer_fire_jets_level_1.cef'
effect = 'clienteffect/entertainer_fire_jets_level_1.cef'
rLevel = 26 # minimum level to perform this effect
if actor.getLevel() < 26:
if commandString == '2':
command = 'FireJets2'
effect = 'clienteffect/entertainer_fire_jets_level_2.cef'
rLevel = 50
elif commandString == '3':
command = 'FireJets3'
effect = 'clienteffect/entertainer_fire_jets_level_3.cef'
rLevel = 75
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
return
# TODO: Find out levels for other firejets 2 and 3
if core.entertainmentService.performEffect(actor, command, effect, target) is True:
actor.sendSystemMessage('@performance:effect_perform_fire_jets', 0)
return
+1 -1
View File
@@ -7,7 +7,7 @@ def setup():
def run(core, actor, target, commandString):
playerObject = actor.getSlottedObject('ghost')
print playerObject.getProfession()
if not playerObject or playerObject.getProfession() != "entertainer_1a":
return
+13 -4
View File
@@ -6,14 +6,23 @@ def setup():
def run(core, actor, target, commandString):
command = 'SmokeBomb1'
effect = 'entertainer_smoke_bomb_level_1.cef'
effect = 'clienteffect/entertainer_smoke_bomb_level_1.cef'
rLevel = 50 # minimum level to perform this effect
if actor.getLevel() < 50:
if commandString == '2':
command = 'SmokeBomb2'
effect = 'clienteffect/entertainer_smoke_bomb_level_2.cef'
rLevel = 75
elif commandString == '3':
command = 'SmokeBomb3'
effect = 'clienteffect/entertainer_smoke_bomb_level_3.cef'
rLevel = 90
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
return
# TODO: Find out levels for other smoke bomb 2 and 3
if core.entertainmentService.performEffect(actor, command, effect, target) is True:
actor.sendSystemMessage('@performance:effect_perform_smoke_bomb', 0)
return
+14 -9
View File
@@ -8,17 +8,22 @@ def run(core, actor, target, commandString):
command = 'SpotLight1'
effect = 'clienteffect/entertainer_spot_light_level_1.cef'
rLevel = 1 # minimum level to perform this effect
# TODO: Figure out what levels the spotlight effects upgraded at.
if actor.getLevel() >= 80:
command == 'SpotLight3'
effect = 'clienteffect/entertainer_spot_light_level_3.cef'
elif actor.getLevel() >= 40:
command == 'SpotLight2'
if commandString == '2':
command = 'SpotLight2'
effect = 'clienteffect/entertainer_spot_light_level_2.cef'
rLevel = 20
elif commandString == '3':
command = 'SpotLight3'
effect = 'clienteffect/entertainer_spot_light_level_3.cef'
rLevel = 30
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
return
if core.entertainmentService.performEffect(actor, command, effect, None) is True:
actor.sendSystemMessage('@performance:effect_perform_spot_light', 0)
return
+13 -4
View File
@@ -6,14 +6,23 @@ def setup():
def run(core, actor, target, commandString):
command = 'Ventriloquism1'
effect = 'entertainer_ventriloquism_level_1.cef'
effect = 'clienteffect/entertainer_ventriloquism_level_1.cef'
rLevel = 58 # minimum level to perform this effect
if actor.getLevel() < 58:
if commandString == '2':
command = 'Ventriloquism2'
effect = 'clienteffect/entertainer_ventriloquism_level_2.cef'
rLevel = 75
elif commandString == '3':
command = 'Ventriloquism3'
effect = 'clienteffect/entertainer_ventriloquism_level_3.cef'
rLevel = 90
if actor.getLevel() < rLevel:
actor.sendSystemMessage('@performance:effect_lack_skill_self')
return
# TODO: Find out levels for other ventriloquism 2 and 3
if core.entertainmentService.performEffect(actor, command, effect, target) is True:
actor.sendSystemMessage('@performance:effect_perform_ventriloquism', 0)
return
@@ -11,8 +11,8 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_intense_performer_1')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
addAbilities(core, actor, player)
return
def removeExpertisePoint(core, actor):
@@ -26,9 +26,8 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_intense_performer_1')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
removeAbilities(core, actor, player)
return
# this checks what abilities the player gets by level, need to also call this on level-up
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_intense_performer_2')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_intense_performer_2')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
removeAbilities(core, actor, player)
return
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_intense_performer_3')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_intense_performer_3')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
removeAbilities(core, actor, player)
return
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_intense_performer_4')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_intense_performer_4')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_pulse_duration_increase', 1)
removeAbilities(core, actor, player)
return
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_lasting_impression_1')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_lasting_impression_1')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
removeAbilities(core, actor, player)
return
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_lasting_impression_2')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_lasting_impression_2')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
removeAbilities(core, actor, player)
return
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_lasting_impression_3')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_lasting_impression_3')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
removeAbilities(core, actor, player)
return
@@ -11,6 +11,7 @@ def addExpertisePoint(core, actor):
return
actor.addSkill('expertise_en_lasting_impression_4')
core.skillModService.addSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
addAbilities(core, actor, player)
return
@@ -26,7 +27,7 @@ def removeExpertisePoint(core, actor):
return
actor.removeSkill('expertise_en_lasting_impression_4')
core.skillModService.deductSkillMod(actor, 'expertise_en_inspire_buff_duration_increase', 30)
removeAbilities(core, actor, player)
return
+2 -2
View File
@@ -5,9 +5,9 @@ import sys
def createRadial(core, owner, target, radials):
if target.getPosture() == Posture.SkillAnimating:
if target.getPerformanceType() is True:
radials.add(RadialOptions(0, 140, 1, 'Watch'))
radials.add(RadialOptions(0, 140, 3, 'Watch'))
else:
radials.add(RadialOptions(0, 140, 1, 'Listen'))
radials.add(RadialOptions(0, 140, 3, 'Listen'))
return
@@ -27,6 +27,7 @@ import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.RGB;
import resources.common.StringUtilities;
public class ShowFlyText extends ObjControllerObject {
@@ -70,6 +71,7 @@ public class ShowFlyText extends ObjControllerObject {
this.scale = scale;
this.color = color;
this.alternativeStructure = true;
this.displayType = displayType;
}
@Override
@@ -117,13 +119,16 @@ public class ShowFlyText extends ObjControllerObject {
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.put(getUnicodeString(customText));
result.putShort(xp);
result.put(getUnicodeString(customText)); // %TO?
result.putShort(xp); // %DI ?
result.putLong(0);
result.putFloat(scale);
result.put(color.getBytes());
result.putInt(displayType);
return result.flip();
result.flip();
//StringUtilities.printBytes(result.array());
return result;
}
}
+24
View File
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.common;
import java.math.BigDecimal;
import engine.resources.scene.*;
public class MathUtilities {
@@ -43,5 +45,27 @@ public class MathUtilities {
q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x);
}
/**
* Converts seconds to a whole hour.
* @author Waverunner
* @param seconds
* @return hour(s)
*/
public static int secondsToWholeHours(int seconds) {
BigDecimal dec = new BigDecimal(seconds);
return dec.divide(new BigDecimal(3600), BigDecimal.ROUND_FLOOR).intValue();
}
/**
* Converts seconds to minutes of the hour.
* @author Waverunner
* @param seconds
* @return hour(s)
*/
public static int secondsToHourMinutes(int seconds) {
BigDecimal dec = new BigDecimal(seconds);
return dec.remainder(new BigDecimal(3600)).divide(new BigDecimal(60), BigDecimal.ROUND_FLOOR).intValue();
}
}
@@ -435,11 +435,15 @@ public class CreatureObject extends TangibleObject implements IPersistent {
}
public ScheduledFuture<?> getInspirationTick() {
return inspirationTick;
synchronized(objectMutex) {
return inspirationTick;
}
}
public void setInspirationTick(ScheduledFuture<?> inspirationTick) {
this.inspirationTick = inspirationTick;
synchronized(objectMutex) {
this.inspirationTick = inspirationTick;
}
}
@Override
@@ -570,6 +574,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
public void addSkillMod(String name, int base) {
if(getSkillMod(name) == null) {
// TODO: This will need to be fixed as it doesn't update in the character sheet properly (wrong delta)
SkillMod skillMod = new SkillMod();
skillMod.setBase(base);
skillMod.setSkillModString(name);
@@ -321,6 +321,18 @@ public class TangibleObject extends SWGObject {
}
}
public void showFlyText(String stfFile, String stfString, String customText, int xp, float scale, RGB color, int displayType, int unkInt) {
Set<Client> observers = getObservers();
if (getClient() != null) {
getClient().getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(getObjectID(), getObjectID(), unkInt, 1, 1, -1, stfFile, stfString, customText, xp, scale, color, displayType))).serialize());
}
for (Client client : observers) {
client.getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(client.getParent().getObjectID(), getObjectID(), unkInt, 1, 1, -1, stfFile, stfString, customText, xp, scale, color, displayType))).serialize());
}
}
public void playEffectObject(String effectFile, String commandString) {
notifyObservers(new PlayClientEffectObjectMessage(effectFile, getObjectID(), commandString), true);
}
+14
View File
@@ -195,6 +195,20 @@ public class ConnectionService implements INetworkDispatch {
object.setInviteCounter(0);
object.setInviteSenderId(0);
object.setInviteSenderName("");
if(object.getAttachment("inspireDuration") != null)
object.setAttachment("inspireDuration", null);
if(object.getInspirationTick() != null) {
object.getInspirationTick().cancel(true);
object.setInspirationTick(null);
}
if(object.getSpectatorTask() != null) {
object.getSpectatorTask().cancel(true);
object.setSpectatorTask(null);
}
core.groupService.handleGroupDisband(object);
for (CreatureObject opponent : object.getDuelList()) {
+60 -15
View File
@@ -24,13 +24,16 @@ import protocol.swg.objectControllerObjects.BuffBuilderEndMessage;
import protocol.swg.objectControllerObjects.BuffBuilderStartMessage;
import resources.common.BuffBuilder;
import resources.common.Console;
import resources.common.MathUtilities;
import resources.common.ObjControllerOpcodes;
import resources.common.Performance;
import resources.common.PerformanceEffect;
import resources.common.RGB;
import resources.common.StringUtilities;
import resources.datatables.Posture;
import resources.objects.Buff;
import resources.objects.BuffItem;
import resources.objects.SWGList;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerObject;
import resources.objects.tangible.TangibleObject;
@@ -38,6 +41,7 @@ import engine.clientdata.ClientFileManager;
import engine.clientdata.visitors.DatatableVisitor;
import engine.clients.Client;
import engine.resources.objects.SWGObject;
import engine.resources.objects.SkillMod;
import engine.resources.service.INetworkDispatch;
import engine.resources.service.INetworkRemoteEvent;
@@ -70,7 +74,7 @@ public class EntertainmentService implements INetworkDispatch {
public void handlePacket(IoSession session, IoBuffer data) throws Exception {
data.order(ByteOrder.LITTLE_ENDIAN);
StringUtilities.printBytes(data.array());
Client client = core.getClient(session);
if(client == null)
@@ -145,8 +149,8 @@ public class EntertainmentService implements INetworkDispatch {
Vector<BuffItem> statBuffs = sentPacket.getStatBuffs();
SWGObject buffer = core.objectService.getObject(sentPacket.getBufferId());
SWGObject buffRecipient = core.objectService.getObject(sentPacket.getBuffRecipientId());
CreatureObject buffer = (CreatureObject) core.objectService.getObject(sentPacket.getBufferId());
CreatureObject buffRecipient = (CreatureObject) core.objectService.getObject(sentPacket.getBuffRecipientId());
if (buffer != buffRecipient) {
@@ -354,7 +358,7 @@ public class EntertainmentService implements INetworkDispatch {
core.commandService.registerCommand("ventriloquism");
}
public void giveInspirationBuff(SWGObject reciever, Vector<BuffItem> buffVector) {
public void giveInspirationBuff(CreatureObject reciever, Vector<BuffItem> buffVector) {
CreatureObject buffCreature = (CreatureObject) reciever;
Vector<BuffBuilder> availableStats = buffBuilderSkills;
@@ -372,19 +376,13 @@ public class EntertainmentService implements INetworkDispatch {
BuffItem stat = new BuffItem(builder.getStatAffects(), item.getInvested(), item.getEntertainerBonus());
stat.setAffectAmount(affectTotal);
/*System.out.println("Invested Points: " + item.getInvested());
System.out.println("Entertainer Bonus: " + item.getEntertainerBonus());
System.out.println("Affect Total: " + affectTotal);*/
stats.add(stat);
break;
}
}
}
reciever.setAttachment("buffWorkshop", buffVector);
reciever.setAttachment("buffWorkshop", stats);
core.buffService.addBuffToCreature(buffCreature, "buildabuff_inspiration");
@@ -481,6 +479,7 @@ public class EntertainmentService implements INetworkDispatch {
}
public void startSpectating(final CreatureObject spectator, final CreatureObject performer) {
final ScheduledFuture<?> spectatorTask = scheduler.scheduleAtFixedRate(new Runnable() {
@Override
@@ -499,14 +498,20 @@ public class EntertainmentService implements INetworkDispatch {
}
spectator.setMoodAnimation("neutral");
performer.removeAudience(spectator);
spectator.getSpectatorTask().cancel(true);
if (spectator.getInspirationTick().cancel(true))
spectator.getSpectatorTask().cancel(true);
}
}
}, 2, 2, TimeUnit.SECONDS);
spectator.setSpectatorTask(spectatorTask);
if(((PlayerObject)performer.getSlottedObject("ghost")).getProfession().equals("entertainer_1a")) {
handleInspirationTicks(spectator, performer);
}
}
public void performFlourish(final CreatureObject performer, int flourish) {
@@ -547,8 +552,6 @@ public class EntertainmentService implements INetworkDispatch {
String performance = (performer.getPerformanceType()) ? "dance" : "music";
// TODO: Skill Level check
if(performer.isPerformingEffect()) {
performer.sendSystemMessage("@performance:effect_wait_self", (byte) 0);
return false;
@@ -591,6 +594,48 @@ public class EntertainmentService implements INetworkDispatch {
return true;
}
public void handleInspirationTicks(final CreatureObject spectator, final CreatureObject performer) {
// http://youtu.be/WqyAde-oC7o?t=11m14s << Player watching entertainer (Has ring only, no pet, + 15 min ticks)
// TODO: Camp/Cantina checks for expertise and duration bonus %. Right now only using basic values.
final ScheduledFuture<?> inspirationTick = scheduler.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
int time = 0; // current buff duration time (minutes)
int buffCap = 215; // 5 hours 35 minutes - 2 hours (buff duration increase bonus) << Taken from video, doesn't account for performance bonuses etc.
if (spectator.getAttachment("inspireDuration") != null)
time+= (int) spectator.getAttachment("inspireDuration");
if (performer.getSkillMod("expertise_en_inspire_buff_duration_increase") != null) {
SkillMod durationMod = performer.getSkillMod("expertise_en_inspire_buff_duration_increase");
buffCap += durationMod.getBase() + durationMod.getModifier();
}
if (time == buffCap) {
} else {
int entTick = 10;
if (performer.getSkillMod("expertise_en_inspire_pulse_duration_increase") != null) {
SkillMod pulseMod = performer.getSkillMod("expertise_en_inspire_pulse_duration_increase");
entTick += pulseMod.getBase() + pulseMod.getModifier();
}
int duration = (time + entTick); // minutes
int hMinutes = MathUtilities.secondsToHourMinutes(duration * 60);
int hours = MathUtilities.secondsToWholeHours(duration * 60);
spectator.showFlyText("spam", "buff_duration_tick_observer", String.valueOf(hours) + " hours , " + hMinutes + " minutes ", 0, (float) 0.66, new RGB(255, 182, 193), 3, 78);
spectator.setAttachment("inspireDuration", duration);
//System.out.println("Inspire Duration: " + spectator.getAttachment("inspireDuration") + " on " + spectator.getCustomName());
}
}
}, 10, 10, TimeUnit.SECONDS);
spectator.setInspirationTick(inspirationTick);
}
@Override
public void shutdown() {