This commit is contained in:
Treeku
2013-12-10 05:45:49 +00:00
32 changed files with 326 additions and 35 deletions

View File

@@ -0,0 +1,10 @@
import sys
def setup(core, actor, buff):
core.skillModService.addSkillMod(actor, 'expertise_healing_all', 20)
return
def removeBuff(core, actor, buff):
core.skillModService.deductSkillMod(actor, 'expertise_healing_all', 20)
return

View File

@@ -0,0 +1,12 @@
import sys
def setup():
return
def run():
return
def addMasterBadge(core, actor):
if actor.getLevel() == 90:
core.collectionService.addCollection(actor, "new_prof_bountyhunter_master")
return

View File

@@ -0,0 +1,12 @@
import sys
def setup():
return
def run():
return
def addMasterBadge(core, actor):
if actor.getLevel() == 90:
core.collectionService.addCollection(actor, "new_prof_commando_master")
return

View File

@@ -0,0 +1,12 @@
import sys
def setup():
return
def run():
return
def addMasterBadge(core, actor):
if actor.getLevel() == 90:
core.collectionService.addCollection(actor, "new_prof_social_entertainer_master")
return

View File

@@ -0,0 +1,12 @@
import sys
def setup():
return
def run():
return
def addMasterBadge(core, actor):
if actor.getLevel() == 90:
core.collectionService.addCollection(actor, "new_prof_jedi_master")
return

View File

@@ -0,0 +1,12 @@
import sys
def setup():
return
def run():
return
def addMasterBadge(core, actor):
if actor.getLevel() == 90:
core.collectionService.addCollection(actor, "new_prof_medic_master")
return

View File

@@ -0,0 +1,12 @@
import sys
def setup():
return
def run():
return
def addMasterBadge(core, actor):
if actor.getLevel() == 90:
core.collectionService.addCollection(actor, "new_prof_officer_master")
return

View File

@@ -0,0 +1,12 @@
import sys
def setup():
return
def run():
return
def addMasterBadge(core, actor):
if actor.getLevel() == 90:
core.collectionService.addCollection(actor, "new_prof_smuggler_master")
return

View File

@@ -0,0 +1,12 @@
import sys
def setup():
return
def run():
return
def addMasterBadge(core, actor):
if actor.getLevel() == 90:
core.collectionService.addCollection(actor, "new_prof_spy_master")
return

View File

@@ -0,0 +1,15 @@
import sys
def setup():
return
def run():
return
def addMasterBadge(core, actor):
if actor.getLevel() == 90:
core.collectionService.addCollection(actor, "new_prof_crafting_merchant_master")
core.collectionService.addCollection(actor, "new_prof_crafting_artisan_master")
core.collectionService.addCollection(actor, "new_prof_crafting_chef_master")
core.collectionService.addCollection(actor, "new_prof_crafting_tailor_master")
return

View File

@@ -0,0 +1,14 @@
import sys
def setup():
return
def run():
return
def addMasterBadge(core, actor):
if actor.getLevel() == 90:
core.collectionService.addCollection(actor, "new_prof_crafting_merchant_master")
core.collectionService.addCollection(actor, "new_prof_crafting_artisan_master")
core.collectionService.addCollection(actor, "new_prof_crafting_architect_master")
return

View File

@@ -0,0 +1,15 @@
import sys
def setup():
return
def run():
return
def addMasterBadge(core, actor):
if actor.getLevel() == 90:
core.collectionService.addCollection(actor, "new_prof_crafting_merchant_master")
core.collectionService.addCollection(actor, "new_prof_crafting_artisan_master")
core.collectionService.addCollection(actor, "new_prof_crafting_armorsmith_master")
core.collectionService.addCollection(actor, "new_prof_crafting_weaponsmith_master")
return

View File

@@ -0,0 +1,14 @@
import sys
def setup():
return
def run():
return
def addMasterBadge(core, actor):
if actor.getLevel() == 90:
core.collectionService.addCollection(actor, "new_prof_crafting_merchant_master")
core.collectionService.addCollection(actor, "new_prof_crafting_artisan_master")
core.collectionService.addCollection(actor, "new_prof_crafting_droidengineer_master")
return

View File

@@ -0,0 +1,9 @@
import sys
def setup():
return
def run(core, actor, target, commandString):
core.buffService.addBuffToCreature(actor, 'co_first_aid_training')
return

View File

@@ -0,0 +1,8 @@
import sys
def setup(core, actor, target, command):
if actor.getSkillMod('expertise_cooldown_line_of_heal'):
command.setCooldown(command.getCooldown() - actor.getSkillMod('expertise_cooldown_line_of_heal').getBase())
return
def run(core, actor, target, commandString):
return

View File

@@ -0,0 +1,8 @@
import sys
def setup(core, actor, target, command):
if actor.getSkillMod('expertise_cooldown_line_of_heal'):
command.setCooldown(command.getCooldown() - actor.getSkillMod('expertise_cooldown_line_of_heal').getBase())
return
def run(core, actor, target, commandString):
return

View File

@@ -0,0 +1,8 @@
import sys
def setup(core, actor, target, command):
if actor.getSkillMod('expertise_cooldown_line_of_heal'):
command.setCooldown(command.getCooldown() - actor.getSkillMod('expertise_cooldown_line_of_heal').getBase())
return
def run(core, actor, target, commandString):
return

View File

@@ -0,0 +1,10 @@
import sys
def setup(core, actor, target, command):
if actor.getSkillMod('expertise_cooldown_line_of_heal'):
command.setCooldown(command.getCooldown() - actor.getSkillMod('expertise_cooldown_line_of_heal').getBase())
return
def run(core, actor, target, commandString):
return

View File

@@ -22,7 +22,8 @@ def run(core, actor, target, commandString):
if actor.getPerformanceId() <= 0:
actor.sendSystemMessage('@performance:flourish_not_performing', 0)
return
actor.incFlourishCount()
actor.sendSystemMessage('@performance:flourish_perform', 0)
animation = 'skill_action_' + str(flourish)
if flourish == 9:

View File

@@ -6,9 +6,7 @@ def setup():
def run(core, actor, target, commandString):
commandArgs = commandString.split("(^-,=+_)color_13548(,+-=_^)=1")
newString = commandArgs[0]
print (newString)
cmdService = core.commandService
cmdService.callCommand(actor, 'waypoint', None, newString) # No need to re-create a script
core.commandService.callCommand(actor, 'waypoint', None, newString)
return

View File

@@ -28,13 +28,16 @@ def run(core, actor, target, commandString):
if command == 'giveExperience' and arg1:
core.playerService.giveExperience(actor, int(arg1))
if command == 'setSpeed' and arg1:
elif command == 'setSpeed' and arg1:
actor.sendSystemMessage('Your speed was ' + str(actor.getSpeedMultiplierBase()) + '. Don\'t forget to set this back or it\'ll permanently imbalance your speed. Default without buffs or mods is 1.', 2)
actor.setSpeedMultiplierBase(float(arg1))
actor.sendSystemMessage('Your new speed is ' + str(actor.getSpeedMultiplierBase()) + '.', 2)
if command == 'teleport' and arg2 and arg3 and arg4:
elif command == 'teleport' and arg2 and arg3 and arg4:
position = Point3D(float(arg2), float(arg3), float(arg4))
core.simulationService.transferToPlanet(actor, core.terrainService.getPlanetByName(arg1), position, actor.getOrientation(), None)
elif command == 'cash' and arg1 is int(arg1):
actor.setCash(actor.getCash() + int(arg1))
actor.sendSystemMessage('The Galactic Empire has transferred ' + arg1 + ' credits to you for your service.')
return

View File

@@ -91,12 +91,16 @@ def startDance(core, actor, danceName, visual):
#this should send a CREO3
actor.setPosture(0x09);
playerObject = actor.getSlottedObject('ghost')
if playerObject and playerObject.getProfession() == "entertainer_1a":
entSvc.startPerformanceExperience(actor)
dance = entSvc.getDance(visual)
# performanceId > 0 seems to trigger the note bubble stuff, so use 0 here
# instead of dance.getLineNumber()
# send CREO6 here
# second param is some sort of counter or start tick
entSvc.startPerformance(actor, 0, -842249156 , danceVisual, 1)
entSvc.startPerformance(actor, dance.getLineNumber(), -842249156 , danceVisual, 1)
return

View File

@@ -74,7 +74,6 @@ def run(core, actor, target, commandString):
waypoint.setActive(True)
waypoint.setColor(WaypointObject.BLUE)
name = commandString.split(" ", 5)
print (name)
if name == "":
name = "Waypoint"

View File

@@ -4,7 +4,8 @@ def setup(core, object):
object.setPosture(0) # land = 0 : away = 2
object.setOptionsBitmask(256)
tp = core.travelService.getNearestTravelPoint(object)
if tp:
if tp and tp is not None:
tp.setShuttle(object)
tp.setShuttleAvailable(True)
tp.setShuttleLanding(False)

View File

@@ -4,7 +4,8 @@ def setup(core, object):
object.setPosture(0) # land = 0 : away = 2
object.setOptionsBitmask(256)
tp = core.travelService.getNearestTravelPoint(object)
if tp:
if tp and tp is not None:
tp.setShuttle(object)
tp.setShuttleAvailable(True)
tp.setShuttleLanding(False)

View File

@@ -256,7 +256,11 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
buffer.putLong(creature.getTargetId());
buffer.put(creature.getMoodId());
buffer.putInt(creature.getPerformanceCounter());
buffer.putInt(creature.getPerformanceId());
/*
* minor dilemma: performance ID is needed for XP calculation, but it can't be sent
* in the CREO, otherwise the evul note bubbles appear
*/
buffer.putInt((creature.getPerformanceType()) ? 0 : creature.getPerformanceId());
buffer.putInt(0); // unks
buffer.putInt(0);

View File

@@ -155,8 +155,14 @@ public class CreatureObject extends TangibleObject implements IPersistent {
private SWGList<DamageOverTime> dotList = new SWGList<DamageOverTime>();
@NotPersistent
private ScheduledFuture<?> incapTask;
@NotPersistent
private ScheduledFuture<?> entertainerExperience;
@NotPersistent
private ScheduledFuture<?> inspirationTick;
private boolean staticNPC = false; // temp
@NotPersistent
private int flourishCount = 0;
public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
super(objectID, planet, Template, position, orientation);
@@ -353,10 +359,14 @@ public class CreatureObject extends TangibleObject implements IPersistent {
public void stopPerformance() {
String type = "";
synchronized(objectMutex) {
setPerformanceId(0);
setPerformanceId(0,true);
setPerformanceCounter(0);
setCurrentAnimation("");
type = (performanceType) ? "dance" : "music";
if (entertainerExperience != null) {
entertainerExperience.cancel(true);
entertainerExperience = null;
}
}
sendSystemMessage("@performance:" + type + "_stop_self",(byte)0);
@@ -391,6 +401,22 @@ public class CreatureObject extends TangibleObject implements IPersistent {
performanceAudience = new SWGList<CreatureObject>();
}
}
public ScheduledFuture<?> getEntertainerExperience() {
return entertainerExperience;
}
public void setEntertainerExperience(ScheduledFuture<?> entertainerExperience) {
this.entertainerExperience = entertainerExperience;
}
public ScheduledFuture<?> getInspirationTick() {
return inspirationTick;
}
public void setInspirationTick(ScheduledFuture<?> inspirationTick) {
this.inspirationTick = inspirationTick;
}
@Override
public void setFaction(String faction) {
synchronized(objectMutex) {
@@ -974,11 +1000,11 @@ public class CreatureObject extends TangibleObject implements IPersistent {
}
}
public void setPerformanceId(int performanceId) {
public void setPerformanceId(int performanceId, boolean isDance) {
synchronized(objectMutex) {
this.performanceId = performanceId;
}
getClient().getSession().write(messageBuilder.buildPerformanceId(performanceId));
getClient().getSession().write(messageBuilder.buildPerformanceId((isDance) ? 0 : performanceId));
}
public boolean getAcceptBandflourishes() {
@@ -1516,5 +1542,23 @@ public class CreatureObject extends TangibleObject implements IPersistent {
return this.performanceType;
}
}
public void setFlourishCount(int flourishCount) {
synchronized(objectMutex) {
this.flourishCount = flourishCount;
}
}
public int getFlourishCount() {
synchronized(objectMutex) {
return this.flourishCount;
}
}
public void incFlourishCount() {
synchronized(objectMutex) {
this.flourishCount++;
}
}
}

View File

@@ -6,6 +6,10 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import main.NGECore;
@@ -34,10 +38,12 @@ import engine.resources.service.INetworkRemoteEvent;
public class EntertainmentService implements INetworkDispatch {
private NGECore core;
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
private Vector<BuffBuilder> buffBuilderSkills = new Vector<BuffBuilder>();
//FIXME: create a wrapper class for double key lookup maps
private HashMap<String,Performance> performances = new HashMap<String,Performance>();
private HashMap<Integer,Performance> performancesByIndex = new HashMap<Integer,Performance>();
private HashMap<Integer,Performance> danceMap = new HashMap<Integer,Performance>();
public EntertainmentService(NGECore core) {
@@ -182,6 +188,7 @@ public class EntertainmentService implements INetworkDispatch {
danceMap.put(new Integer(p.getDanceVisualId()), p);
}
performances.put(p.getPerformanceName(), p);
performancesByIndex.put(r, p);
}
} catch (InstantiationException | IllegalAccessException e) {
@@ -293,7 +300,7 @@ public class EntertainmentService implements INetworkDispatch {
}
public void startPerformance(CreatureObject actor, int performanceId, int performanceCounter, String skillName, boolean isDance) {
actor.setPerformanceId(performanceId);
actor.setPerformanceId(performanceId, isDance);
actor.setPerformanceCounter(performanceCounter);
actor.setCurrentAnimation(skillName);
actor.setPerformanceType(isDance);
@@ -301,8 +308,34 @@ public class EntertainmentService implements INetworkDispatch {
actor.startPerformance();
}
public void startPerformanceExperience(final CreatureObject entertainer) {
final ScheduledFuture<?> experienceTask = scheduler.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
Performance p = performancesByIndex.get(entertainer.getPerformanceId());
if (p == null) {
entertainer.setFlourishCount(0);
return;
}
int floXP = p.getFlourishXpMod();
int floCount = entertainer.getFlourishCount();
int XP = ((floCount > 2) ? 2 : floCount) * floXP;
entertainer.setFlourishCount(0);
core.playerService.giveExperience(entertainer, XP);
}
},10, 10000, TimeUnit.MILLISECONDS);
entertainer.setEntertainerExperience(experienceTask);
}
@Override
public void shutdown() {

View File

@@ -338,6 +338,7 @@ public class PlayerService implements INetworkDispatch {
creature.playEffectObject("clienteffect/level_granted.cef", "");
creature.getClient().getSession().write((new ClientMfdStatusUpdateMessage((float) ((creature.getLevel() == 90) ? 90 : (creature.getLevel() + 1)), "/GroundHUD.MFDStatus.vsp.role.targetLevel")).serialize());
creature.setLevel(((Integer) experienceTable.getObject(i, 0)).shortValue());
core.scriptService.callScript("scripts/collections/", "addMasterBadge", "master_" + player.getProfession(), core, creature);
// 3. Add the relevant health/action and expertise points.
float luck = (((((float) (core.scriptService.getMethod("scripts/roadmap/", player.getProfession(), "getLuck").__call__().asInt()) + (core.scriptService.getMethod("scripts/roadmap/", creature.getStfName(), "getLuck").__call__().asInt())) / ((float) 90)) * ((float) creature.getLevel())) - ((float) creature.getSkillModBase("luck")));
@@ -470,7 +471,7 @@ public class PlayerService implements INetworkDispatch {
}
}
}
}
}
}
}
} catch (InstantiationException | IllegalAccessException e) {

View File

@@ -307,6 +307,7 @@ public class CombatCommands {
core.commandService.registerCommand("co_hw_dot");
core.commandService.registerCommand("co_ae_hw_dot");
core.commandService.registerCommand("co_position_secured");
core.commandService.registerCommand("co_first_aid_training");
// Entertainer
@@ -424,14 +425,15 @@ public class CombatCommands {
core.commandService.registerCombatCommand("me_traumatize_4");
core.commandService.registerCombatCommand("me_traumatize_5");
core.commandService.registerCombatCommand("me_stasis_1");
core.commandService.registerCommand("me_stasis_self_1");
core.commandService.registerCommand("me_drag_1");
core.commandService.registerCommand("me_enhance_action_1");
core.commandService.registerCommand("me_reckless_stimulation_1");
core.commandService.registerCommand("me_reckless_stimulation_2");
core.commandService.registerCommand("me_reckless_stimulation_3");
core.commandService.registerCommand("me_reckless_stimulation_4");
core.commandService.registerCommand("me_reckless_stimulation_5");
core.commandService.registerCommand("me_reckless_stimulation_6");
core.commandService.registerCommand("me_stasis_self_1");
// Officer

View File

@@ -404,22 +404,12 @@ public class CombatService implements INetworkDispatch {
}
private void sendHealPackets(CreatureObject attacker, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) {
float cooldown = 0;
CombatAction combatAction = new CombatAction(CRC.StringtoCRC(command.getDefaultAnimations()[0]), attacker.getObjectID(), weapon.getObjectID(), target.getObjectID(), command.getCommandCRC());
ObjControllerMessage objController = new ObjControllerMessage(0x1B, combatAction);
attacker.notifyObserversInRange(objController, true, 125);
cooldown = command.getCooldown();
System.out.println(cooldown);
if(attacker.getSkillMod("expertise_cooldown_line_of_heal") != null)
cooldown -= attacker.getSkillMod("expertise_cooldown_line_of_heal").getBase();
if(attacker.getSkillMod("expertise_cooldown_line_sh") != null)
cooldown -= ((attacker.getSkillMod("expertise_cooldown_line_sh").getBase())/10);
StartTask startTask = new StartTask(actionCounter, attacker.getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), cooldown);
StartTask startTask = new StartTask(actionCounter, attacker.getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), command.getCooldown());
ObjControllerMessage objController2 = new ObjControllerMessage(0x0B, startTask);
attacker.getClient().getSession().write(objController2.serialize());

View File

@@ -156,9 +156,12 @@ public class TravelService implements INetworkDispatch {
}
}
if (returnedPoint == null) {
System.out.println("NULL TravelPoint at : " + core.mapService.getClosestCityName(obj));
}
// Some transport obj's were used as deco (ex: ACLO bunker on Talus shared_player_transport). A null check should be performed before tp is used.
/*if (returnedPoint == null) {
System.out.println("Could not find travel point for " + obj.getTemplate() + " at " + obj.getPlanet().name + " Position: " + obj.getPosition().x + " " + obj.getPosition().z);
//Console.println("Travel Point NULL: " + returnedPoint.getName());
}*/
return returnedPoint;
}