mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-14 00:02:07 -04:00
temp commit for ent stuff
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package services;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -17,6 +19,7 @@ import protocol.swg.objectControllerObjects.BuffBuilderStartMessage;
|
||||
import resources.common.BuffBuilder;
|
||||
import resources.common.Console;
|
||||
import resources.common.ObjControllerOpcodes;
|
||||
import resources.common.Performance;
|
||||
import resources.objects.Buff;
|
||||
import resources.objects.BuffItem;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
@@ -33,10 +36,15 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
private NGECore core;
|
||||
|
||||
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> danceMap = new HashMap<Integer,Performance>();
|
||||
|
||||
public EntertainmentService(NGECore core) {
|
||||
this.core = core;
|
||||
populateSkillCaps();
|
||||
populatePerformanceTable();
|
||||
registerCommands();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,6 +136,58 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
});
|
||||
}
|
||||
|
||||
private void populatePerformanceTable() {
|
||||
|
||||
try {
|
||||
DatatableVisitor PerformanceVisitor = ClientFileManager.loadFile("datatables/performance/performance.iff", DatatableVisitor.class);
|
||||
|
||||
//rformanceVisitor.
|
||||
|
||||
for (int r = 0; r < PerformanceVisitor.getRowCount(); r++) {
|
||||
Performance p = new Performance();
|
||||
|
||||
/* for (int j=0; j < PerformanceVisitor.getColumnCount(); j++) {
|
||||
System.out.println(j + ": " + PerformanceVisitor.getObject(r, j));
|
||||
}*/
|
||||
|
||||
p.setPerformanceName( ( (String) PerformanceVisitor.getObject(r, 0) ).toLowerCase());
|
||||
p.setInstrumentAudioId((int) PerformanceVisitor.getObject(r, 1));
|
||||
p.setRequiredSong((String) PerformanceVisitor.getObject(r, 2));
|
||||
p.setRequiredInstrument((String) PerformanceVisitor.getObject(r, 3));
|
||||
p.setRequiredDance((String) PerformanceVisitor.getObject(r, 4));
|
||||
p.setDanceVisualId((int) PerformanceVisitor.getObject(r, 5));
|
||||
p.setActionPointsPerLoop((int) PerformanceVisitor.getObject(r, 6));
|
||||
p.setLoopDuration((float) PerformanceVisitor.getObject(r, 7));
|
||||
p.setType((int) PerformanceVisitor.getObject(r, 8));
|
||||
p.setBaseXp((int) PerformanceVisitor.getObject(r, 9));
|
||||
p.setFlourishXpMod((int) PerformanceVisitor.getObject(r, 10));
|
||||
p.setHealMindWound((int) PerformanceVisitor.getObject(r, 11));
|
||||
p.setHealShockWound((int) PerformanceVisitor.getObject(r, 12));
|
||||
p.setRequiredSkillMod((String) PerformanceVisitor.getObject(r, 13));
|
||||
p.setRequiredSkillModValue((int) PerformanceVisitor.getObject(r, 14));
|
||||
p.setMainloop((String) PerformanceVisitor.getObject(r, 15));
|
||||
p.setFlourish1((String) PerformanceVisitor.getObject(r, 16));
|
||||
p.setFlourish2((String) PerformanceVisitor.getObject(r, 17));
|
||||
p.setFlourish3((String) PerformanceVisitor.getObject(r, 18));
|
||||
p.setFlourish4((String) PerformanceVisitor.getObject(r, 19));
|
||||
p.setFlourish5((String) PerformanceVisitor.getObject(r, 20));
|
||||
p.setFlourish6((String) PerformanceVisitor.getObject(r, 21));
|
||||
p.setFlourish7((String) PerformanceVisitor.getObject(r, 22));
|
||||
p.setFlourish8((String) PerformanceVisitor.getObject(r, 23));
|
||||
p.setIntro((String) PerformanceVisitor.getObject(r, 24));
|
||||
p.setOutro((String) PerformanceVisitor.getObject(r, 25));
|
||||
|
||||
if (p.getType() == -1788534963) {
|
||||
danceMap.put(new Integer(p.getDanceVisualId()), p);
|
||||
}
|
||||
performances.put(p.getPerformanceName(), p);
|
||||
}
|
||||
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void populateSkillCaps() {
|
||||
try {
|
||||
DatatableVisitor buffBuilder = ClientFileManager.loadFile("datatables/buff/buff_builder.iff", DatatableVisitor.class);
|
||||
@@ -152,6 +212,10 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void registerCommands() {
|
||||
core.commandService.registerCommand("startdance");
|
||||
}
|
||||
|
||||
public void giveInspirationBuff(SWGObject reciever, Vector<BuffItem> buffVector) {
|
||||
CreatureObject buffCreature = (CreatureObject) reciever;
|
||||
@@ -177,6 +241,37 @@ public class EntertainmentService implements INetworkDispatch {
|
||||
|
||||
}
|
||||
|
||||
public Map<Long,String> getAvailableDances(CreatureObject actor) {
|
||||
|
||||
Map<Long,String> dances = new HashMap<Long, String>();
|
||||
for (int index : danceMap.keySet()) {
|
||||
if (!canDance(actor, danceMap.get(index) )) { continue; }
|
||||
dances.put( new Long(index), danceMap.get(index).getPerformanceName() );
|
||||
}
|
||||
|
||||
return dances;
|
||||
|
||||
}
|
||||
|
||||
public boolean isDance(String danceName) {
|
||||
return ( performances.get(danceName) != null && performances.get(danceName).getType() == -1788534963);
|
||||
}
|
||||
|
||||
public boolean canDance(CreatureObject actor, Performance dance) {
|
||||
for (String x : actor.getAbilities() ) {
|
||||
System.out.println(x);
|
||||
}
|
||||
if (actor.hasAbility(dance.getRequiredDance())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canDance(CreatureObject actor, String danceName) {
|
||||
if (!isDance(danceName)) { return false; }
|
||||
return canDance(actor, performances.get(danceName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user