Fixed some stuff

This commit is contained in:
Seefo
2014-03-28 07:09:16 -04:00
parent ee071aa877
commit f9990a2bd5
6 changed files with 48 additions and 18 deletions
+6
View File
@@ -35,6 +35,7 @@ import java.util.function.UnaryOperator;
import java.util.stream.Stream;
import org.apache.mina.core.buffer.IoBuffer;
import org.python.google.common.collect.Lists;
import com.sleepycat.persist.model.NotPersistent;
import com.sleepycat.persist.model.Persistent;
@@ -395,6 +396,11 @@ public class SWGList<E> implements List<E> {
public boolean removeIf(Predicate<? super E> filter) {
return false;
}
public List<E> reverseGet()
{
return Lists.reverse(list);
}
@Override
public Stream<E> stream() {
@@ -613,13 +613,11 @@ public class CreatureObject extends TangibleObject implements IPersistent {
removeSkillMod(mod);
} else {
skillMods.set(skillMods.indexOf(mod), mod);
System.out.println("Deducted mod!");
if(getClient() != null) {
setSkillModsUpdateCounter((short) (getSkillModsUpdateCounter() + 1));
getClient().getSession().write(messageBuilder.buildAddSkillModDelta(name, mod.getBase()));
}
}
}
public void removeSkillMod(SkillMod mod) {
@@ -1063,7 +1061,9 @@ public class CreatureObject extends TangibleObject implements IPersistent {
}
public SWGList<SWGObject> getEquipmentList() {
synchronized(objectMutex) {
return equipmentList;
}
}
public SWGList<Buff> getBuffList() {
@@ -1309,6 +1309,8 @@ public class CreatureObject extends TangibleObject implements IPersistent {
public void setMaxHealth(int maxHealth) {
synchronized(objectMutex) {
if(this.maxHealth == maxHealth) return;
this.maxHealth = maxHealth;
setMaxHAMListCounter(getMaxHAMListCounter() + 1);
if(maxHealth < getHealth())
@@ -1325,6 +1327,8 @@ public class CreatureObject extends TangibleObject implements IPersistent {
public void setMaxAction(int maxAction) {
synchronized(objectMutex) {
if(this.maxAction == maxAction) return;
this.maxAction = maxAction;
setMaxHAMListCounter(getMaxHAMListCounter() + 1);
if(maxAction < getAction())
@@ -233,7 +233,9 @@ public class TangibleObject extends SWGObject {
}
public Vector<TangibleObject> getDefendersList() {
return defendersList;
synchronized(objectMutex) {
return defendersList;
}
}
public void addDefender(TangibleObject defender) {
+12 -3
View File
@@ -123,14 +123,23 @@ public class DevService implements INetworkDispatch {
// Character
case 10: // Set combat level to 90
core.playerService.grantLevel(player, 90);
//core.playerService.grantLevel(player, 90); // Commented out until fixed
core.playerService.giveExperience(player, 999999999);
return;
case 11: // Give 100,000 credits
player.setCashCredits(player.getCashCredits() + 100000);
return;
case 12: // Reset expertise
player.getSkills().get().stream().filter(s -> s.contains("expertise")).forEach(s -> core.skillService.removeSkill(creature, s));
return;
// Seefo->Light: I commented out the below line because it gave us an error and didn't properly remove the skill, could you try the method SWGList.reverseGet that I added?
//player.getSkills().get().stream().filter(s -> s.contains("expertise")).forEach(s -> core.skillService.removeSkill(creature, s));
// Using this for now
for(int i = creature.getSkills().size() - 1; i >= 0; i-- )
{
String skill = creature.getSkills().get(i);
if(skill.contains("expertise")) core.skillService.removeSkill(player, skill);
}
return;
// Items
case 20: // (Light) Jedi Robe
+17 -10
View File
@@ -619,22 +619,25 @@ public class PlayerService implements INetworkDispatch {
player.setXp(xpType, experience);
// 2. 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) level);
float precision = (((float) ((core.scriptService.getMethod("scripts/roadmap/", player.getProfession(), "getPrecision").__call__().asInt() + (core.scriptService.getMethod("scripts/roadmap/", creature.getStfName(), "getPrecision").__call__().asInt()) / (float) 90) * (float) level);
float strength = (((float) ((core.scriptService.getMethod("scripts/roadmap/", player.getProfession(), "getStrength").__call__().asInt() + (core.scriptService.getMethod("scripts/roadmap/", creature.getStfName(), "getStrength").__call__().asInt()) / (float) 90) * (float) level);
float constitution = (((float) ((core.scriptService.getMethod("scripts/roadmap/", player.getProfession(), "getConstitution").__call__().asInt() + (core.scriptService.getMethod("scripts/roadmap/", creature.getStfName(), "getConstitution").__call__().asInt()) / (float) 90) * (float) level);
float stamina = (((float) ((core.scriptService.getMethod("scripts/roadmap/", player.getProfession(), "getStamina").__call__().asInt() + (core.scriptService.getMethod("scripts/roadmap/", creature.getStfName(), "getStamina").__call__().asInt()) / (float) 90) * (float) level);
float agility = (((float) ((core.scriptService.getMethod("scripts/roadmap/", player.getProfession(), "getAgility").__call__().asInt() + (core.scriptService.getMethod("scripts/roadmap/", creature.getStfName(), "getAgility").__call__().asInt()) / (float) 90) * (float) level);
float luck = 0, precision = 0, strength = 0, constitution = 0, stamina = 0, agility = 0;
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) level)) - ((float) creature.getSkillModBase("luck")));
precision = (((((float) (core.scriptService.getMethod("scripts/roadmap/", player.getProfession(), "getPrecision").__call__().asInt()) + (core.scriptService.getMethod("scripts/roadmap/", creature.getStfName(), "getPrecision").__call__().asInt())) / ((float) 90)) * ((float) level)) - ((float) creature.getSkillModBase("precision")));
strength = (((((float) (core.scriptService.getMethod("scripts/roadmap/", player.getProfession(), "getStrength").__call__().asInt()) + (core.scriptService.getMethod("scripts/roadmap/", creature.getStfName(), "getStrength").__call__().asInt())) / ((float) 90)) * ((float) level)) - ((float) creature.getSkillModBase("strength")));
constitution = (((((float) (core.scriptService.getMethod("scripts/roadmap/", player.getProfession(), "getConstitution").__call__().asInt()) + (core.scriptService.getMethod("scripts/roadmap/", creature.getStfName(), "getConstitution").__call__().asInt())) / ((float) 90)) * ((float) level)) - ((float) creature.getSkillModBase("constitution")));
stamina = (((((float) (core.scriptService.getMethod("scripts/roadmap/", player.getProfession(), "getStamina").__call__().asInt()) + (core.scriptService.getMethod("scripts/roadmap/", creature.getStfName(), "getStamina").__call__().asInt())) / ((float) 90)) * ((float) level)) - ((float) creature.getSkillModBase("stamina")));
agility = (((((float) (core.scriptService.getMethod("scripts/roadmap/", player.getProfession(), "getAgility").__call__().asInt()) + (core.scriptService.getMethod("scripts/roadmap/", creature.getStfName(), "getAgility").__call__().asInt())) / ((float) 90)) * ((float) level)) - ((float) creature.getSkillModBase("agility")));
float health = (100 * level);
float action = (75 * level);
int healthGranted = 0;
int healthGranted = ((Integer) experienceTable.getObject((level - 1), 4));;
for (int i = 1; i < level; i++) {
healthGranted += ((Integer) experienceTable.getObject((i - 0), 4));
for (int i = 1; i <= level; i++) {
//System.out.println("Now: " + healthGranted + ", adding: " + ((Integer) experienceTable.getObject((i - 1), 4)));
//healthGranted = ((Integer) experienceTable.getObject((i - 1), 4));
// 3. Add skills and roadmap items.
if ((i == 4 || i == 7 || i == 10) || ((i > 10) && (((i - 10) % 4) == 0))) {
int skill = ((i <= 10) ? ((i - 1) / 3) : ((((i - 10) / 4)) + 3));
String roadmapSkillName = "";
@@ -720,6 +723,9 @@ public class PlayerService implements INetworkDispatch {
creature.setAction(creature.getMaxAction());
creature.setGrantedHealth(healthGranted);
System.out.print("Health: " + creature.getHealth());
System.out.print("Constitution: " + healthGranted);
creature.getClient().getSession().write((new ClientMfdStatusUpdateMessage((float) ((level >= 90) ? 90 : (level + 1)), "/GroundHUD.MFDStatus.vsp.role.targetLevel")).serialize());
creature.setLevel((short) level);
core.scriptService.callScript("scripts/collections/", "master_" + player.getProfession(), "addMasterBadge", core, creature);
@@ -727,6 +733,7 @@ public class PlayerService implements INetworkDispatch {
creature.showFlyText("cbt_spam", "skill_up", (float) 2.5, new RGB(154, 205, 50), 0);
creature.playEffectObject("clienteffect/skill_granted.cef", "");
creature.playMusic("sound/music_acq_bountyhunter.snd");
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
+4 -2
View File
@@ -189,7 +189,7 @@ public class SkillService implements INetworkDispatch {
}
try {
skillTable = ClientFileManager.loadFile("datatables/skills/skills.iff", DatatableVisitor.class);
skillTable = ClientFileManager.loadFile("datatables/skill/skills.iff", DatatableVisitor.class);
for (int s = 0; s < skillTable.getRowCount(); s++) {
if (skillTable.getObject(s, 0) != null) {
@@ -218,7 +218,7 @@ public class SkillService implements INetworkDispatch {
for (String ability : abilities) {
creature.removeAbility(ability);
}
}
}
for (String skillMod : skillMods) {
core.skillModService.deductSkillMod(creature, skillMod.split("=")[0], new Integer(skillMod.split("=")[1]));
@@ -231,6 +231,8 @@ public class SkillService implements INetworkDispatch {
for (String schematic : schematicsRevoked) {
//player.getDraftSchematicList().add(new DraftSchematic());
}
creature.removeSkill(skill);
}
}
}