mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-11 21:45:43 -04:00
temp commit for ent stuff
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
from services.sui import SUIWindow
|
||||
from services.sui import SUIService
|
||||
from services.sui.SUIWindow import Trigger
|
||||
from services.sui.SUIService import ListBoxType
|
||||
from java.util import Vector
|
||||
from java.util import HashMap
|
||||
import sys
|
||||
|
||||
def setup():
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
|
||||
entSvc = core.entertainmentService
|
||||
|
||||
if len(commandString) > 0:
|
||||
params = commandString.split(" ")
|
||||
startDance(core, actor, params[0])
|
||||
return
|
||||
else:
|
||||
|
||||
available_dances = entSvc.getAvailableDances(actor)
|
||||
|
||||
suiSvc = core.suiService
|
||||
suiWindow = suiSvc.createListBox(ListBoxType.LIST_BOX_OK_CANCEL, "@performance:select_dance", "@performance:available_dances", available_dances, actor, actor, 10)
|
||||
|
||||
returnParams = Vector()
|
||||
returnParams.add('btnOk:Text')
|
||||
returnParams.add('btnCancel:Text')
|
||||
suiWindow.addHandler(0, '', Trigger.TRIGGER_OK, returnParams, handleStartdance)
|
||||
suiWindow.addHandler(1, '', Trigger.TRIGGER_CANCEL, returnParams, handleStartdance)
|
||||
|
||||
suiSvc.openSUIWindow(suiWindow)
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
def handleStartdance(core, owner, eventType, returnList):
|
||||
return
|
||||
|
||||
def startDance(core, actor, danceName):
|
||||
|
||||
entSvc = core.entertainmentService
|
||||
|
||||
if not entSvc.isDance(danceName):
|
||||
actor.sendSystemMessage('@performance:dance_unknown_self',0)
|
||||
return
|
||||
|
||||
if not entSvc.canDance(actor, danceName):
|
||||
actor.sendSystemMessage('@performance:dance_lack_skill_self',0)
|
||||
return
|
||||
return
|
||||
@@ -39,6 +39,15 @@ public class CommandEnqueue extends ObjControllerObject {
|
||||
public static final int STAND = 0xA8A25C79;
|
||||
public static final int ATTACK = 0xA8FEF90A;
|
||||
public static final int TRANSFERITEM = 0x3CFB449D;
|
||||
|
||||
//ent
|
||||
// this really needed?
|
||||
public static final int STARTDANCE = 0x7B1DCBE0;
|
||||
public static final int STOPDANCE = 0xECC171CC;
|
||||
public static final int FLOURISH = 0xC8998CE9;
|
||||
public static final int FLO = 0x3B159B76;
|
||||
public static final int BANDFLOURISH = 0xF4C60EC3;
|
||||
public static final int BANDFLO = 0xDD3FB008;
|
||||
|
||||
private int actionCounter;
|
||||
private int commandCRC;
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
package resources.common;
|
||||
|
||||
public class Performance {
|
||||
|
||||
|
||||
private String performanceName;
|
||||
private int instrumentAudioId;
|
||||
private String requiredSong;
|
||||
private String requiredInstrument;
|
||||
private String requiredDance;
|
||||
private int danceVisualId;
|
||||
private int actionPointsPerLoop;
|
||||
private float loopDuration;
|
||||
private int type;
|
||||
private int baseXp;
|
||||
private int flourishXpMod;
|
||||
private int healMindWound;
|
||||
private int healShockWound;
|
||||
private String requiredSkillMod;
|
||||
private int requiredSkillModValue;
|
||||
private String mainloop;
|
||||
private String flourish1;
|
||||
private String flourish2;
|
||||
private String flourish3;
|
||||
private String flourish4;
|
||||
private String flourish5;
|
||||
private String flourish6;
|
||||
private String flourish7;
|
||||
private String flourish8;
|
||||
private String intro;
|
||||
private String outro;
|
||||
|
||||
public Performance() {
|
||||
|
||||
}
|
||||
|
||||
public int getBaseXp() {
|
||||
return baseXp;
|
||||
}
|
||||
|
||||
public void setBaseXp(int baseXp) {
|
||||
this.baseXp = baseXp;
|
||||
}
|
||||
|
||||
public String getPerformanceName() {
|
||||
return performanceName;
|
||||
}
|
||||
|
||||
public void setPerformanceName(String performanceName) {
|
||||
this.performanceName = performanceName;
|
||||
}
|
||||
|
||||
public int getInstrumentAudioId() {
|
||||
return instrumentAudioId;
|
||||
}
|
||||
|
||||
public void setInstrumentAudioId(int instrumentAudioId) {
|
||||
this.instrumentAudioId = instrumentAudioId;
|
||||
}
|
||||
|
||||
public int getRequiredSkillModValue() {
|
||||
return requiredSkillModValue;
|
||||
}
|
||||
|
||||
public void setRequiredSkillModValue(int requiredSkillModValue) {
|
||||
this.requiredSkillModValue = requiredSkillModValue;
|
||||
}
|
||||
|
||||
public String getRequiredSong() {
|
||||
return requiredSong;
|
||||
}
|
||||
|
||||
public void setRequiredSong(String requiredSong) {
|
||||
this.requiredSong = requiredSong;
|
||||
}
|
||||
|
||||
public String getRequiredInstrument() {
|
||||
return requiredInstrument;
|
||||
}
|
||||
|
||||
public void setRequiredInstrument(String requiredInstrument) {
|
||||
this.requiredInstrument = requiredInstrument;
|
||||
}
|
||||
|
||||
public String getRequiredDance() {
|
||||
return requiredDance;
|
||||
}
|
||||
|
||||
public void setRequiredDance(String requiredDance) {
|
||||
this.requiredDance = requiredDance;
|
||||
}
|
||||
|
||||
public int getDanceVisualId() {
|
||||
return danceVisualId;
|
||||
}
|
||||
|
||||
public void setDanceVisualId(int danceVisualId) {
|
||||
this.danceVisualId = danceVisualId;
|
||||
}
|
||||
|
||||
public int getActionPointsPerLoop() {
|
||||
return actionPointsPerLoop;
|
||||
}
|
||||
|
||||
public void setActionPointsPerLoop(int actionPointsPerLoop) {
|
||||
this.actionPointsPerLoop = actionPointsPerLoop;
|
||||
}
|
||||
|
||||
public float getLoopDuration() {
|
||||
return loopDuration;
|
||||
}
|
||||
|
||||
public void setLoopDuration(float loopDuration) {
|
||||
this.loopDuration = loopDuration;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getFlourishXpMod() {
|
||||
return flourishXpMod;
|
||||
}
|
||||
|
||||
public void setFlourishXpMod(int flourishXpMod) {
|
||||
this.flourishXpMod = flourishXpMod;
|
||||
}
|
||||
|
||||
public int getHealMindWound() {
|
||||
return healMindWound;
|
||||
}
|
||||
|
||||
public void setHealMindWound(int healMindWound) {
|
||||
this.healMindWound = healMindWound;
|
||||
}
|
||||
|
||||
public int getHealShockWound() {
|
||||
return healShockWound;
|
||||
}
|
||||
|
||||
public void setHealShockWound(int healShockWound) {
|
||||
this.healShockWound = healShockWound;
|
||||
}
|
||||
|
||||
public String getRequiredSkillMod() {
|
||||
return requiredSkillMod;
|
||||
}
|
||||
|
||||
public void setRequiredSkillMod(String requiredSkillMod) {
|
||||
this.requiredSkillMod = requiredSkillMod;
|
||||
}
|
||||
|
||||
public String getMainloop() {
|
||||
return mainloop;
|
||||
}
|
||||
|
||||
public void setMainloop(String mainloop) {
|
||||
this.mainloop = mainloop;
|
||||
}
|
||||
|
||||
public String getFlourish1() {
|
||||
return flourish1;
|
||||
}
|
||||
|
||||
public void setFlourish1(String flourish1) {
|
||||
this.flourish1 = flourish1;
|
||||
}
|
||||
|
||||
public String getFlourish2() {
|
||||
return flourish2;
|
||||
}
|
||||
|
||||
public void setFlourish2(String flourish2) {
|
||||
this.flourish2 = flourish2;
|
||||
}
|
||||
|
||||
public String getFlourish3() {
|
||||
return flourish3;
|
||||
}
|
||||
|
||||
public void setFlourish3(String flourish3) {
|
||||
this.flourish3 = flourish3;
|
||||
}
|
||||
|
||||
public String getFlourish4() {
|
||||
return flourish4;
|
||||
}
|
||||
|
||||
public void setFlourish4(String flourish4) {
|
||||
this.flourish4 = flourish4;
|
||||
}
|
||||
|
||||
public String getFlourish5() {
|
||||
return flourish5;
|
||||
}
|
||||
|
||||
public void setFlourish5(String flourish5) {
|
||||
this.flourish5 = flourish5;
|
||||
}
|
||||
|
||||
public String getFlourish6() {
|
||||
return flourish6;
|
||||
}
|
||||
|
||||
public void setFlourish6(String flourish6) {
|
||||
this.flourish6 = flourish6;
|
||||
}
|
||||
|
||||
public String getFlourish7() {
|
||||
return flourish7;
|
||||
}
|
||||
|
||||
public void setFlourish7(String flourish7) {
|
||||
this.flourish7 = flourish7;
|
||||
}
|
||||
|
||||
public String getFlourish8() {
|
||||
return flourish8;
|
||||
}
|
||||
|
||||
public void setFlourish8(String flourish8) {
|
||||
this.flourish8 = flourish8;
|
||||
}
|
||||
|
||||
public String getIntro() {
|
||||
return intro;
|
||||
}
|
||||
|
||||
public void setIntro(String intro) {
|
||||
this.intro = intro;
|
||||
}
|
||||
|
||||
public String getOutro() {
|
||||
return outro;
|
||||
}
|
||||
|
||||
public void setOutro(String outro) {
|
||||
this.outro = outro;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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() {
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
******************************************************************************/
|
||||
package services.object;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteOrder;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -237,10 +238,12 @@ public class ObjectService implements INetworkDispatch {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("!File Not Found:" + template.toString());
|
||||
} catch (IOException e) {
|
||||
System.out.println("!IO error " + template.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public SWGObject createObject(String Template, Planet planet) {
|
||||
|
||||
Reference in New Issue
Block a user