Browse Source

refund points from lost spells

master
FatBoy-DOTC 2 years ago
parent
commit
743e1f150d
  1. 1
      src/engine/net/client/msg/RefineMsg.java
  2. 51
      src/engine/objects/PlayerCharacter.java

1
src/engine/net/client/msg/RefineMsg.java

@ -168,6 +168,7 @@ public class RefineMsg extends ClientNetMsg {
RefinerScreenMsg refinerScreenMsg = new RefinerScreenMsg(skillPower, npc.getSellPercent(pc)); //TODO set npc cost RefinerScreenMsg refinerScreenMsg = new RefinerScreenMsg(skillPower, npc.getSellPercent(pc)); //TODO set npc cost
dispatch = Dispatch.borrow(pc, refinerScreenMsg); dispatch = Dispatch.borrow(pc, refinerScreenMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
pc.recalculate();
} }
} }

51
src/engine/objects/PlayerCharacter.java

@ -1357,57 +1357,6 @@ public class PlayerCharacter extends AbstractCharacter {
} }
} }
//insert test run for lowered focus lines with trained spells
boolean tester = false;
switch(stat){
case MBServerStatics.STAT_STR_ID:
tester = refineStr();
break;
case MBServerStatics.STAT_DEX_ID:
tester = refineDex();
break;
case MBServerStatics.STAT_CON_ID:
tester = refineCon();
break;
case MBServerStatics.STAT_INT_ID:
tester = refineInt(null);
break;
case MBServerStatics.STAT_SPI_ID:
tester = refineSpi();
break;
}
//loop through all skills and all powers to ensure that the refine doesn't yield a power no longer able to be cast
for(CharacterSkill charSkill : this.getSkills().values()) {
for (CharacterPower power : this.getPowers().values()) {
ArrayList<PowerReq> reqs = PowerReq.getPowerReqsForRune(power.getPowerID());
for (PowerReq req : reqs) {
ConcurrentHashMap<String, CharacterSkill> playerSkills = this.getSkills();
CharacterSkill playerSkill = playerSkills.get(charSkill.getToken());
int currentSkillLevel = playerSkill.getTotalSkillPercet();
if (charSkill.getToken() == req.getToken() && req.getLevel() > currentSkillLevel) {
//refund the point taken in the test
switch(stat){
case MBServerStatics.STAT_STR_ID:
this.addStr(1);
break;
case MBServerStatics.STAT_DEX_ID:
this.addDex(1);
break;
case MBServerStatics.STAT_CON_ID:
this.addCon(1);
break;
case MBServerStatics.STAT_INT_ID:
this.addInt(1);
break;
case MBServerStatics.STAT_SPI_ID:
this.addSpi(1);
break;
}
return false;
}
}
}
}
return true; return true;
} }

Loading…
Cancel
Save