Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @filename PrecastChargedSkill.js
- * @author DHD
- * @desc handle player prebuff sequence for chargedskills only - temporary until merged into precast.js
- * @WARNING If you are wearing hoto and wisp and/or NP and you cast oak FIRST then switch to CTA, as you switch
- * it kills the oak, EVEN if you casted the NP/Wisp version!!!
- * the answer is to precast cta first then cast oak via PrecastChargedSkill, or dont use it with hoto
- */
- function PrecastChargedSkill (force) {
- if (!force && me.getState(149)) {
- //print("failed getstate");
- return true;
- }
- if (me.gametype === 0 || me.inTown) {
- return false;
- }
- var bestChargeLevel = 0;
- for (var i = 0; i < Skill.charges.length; i++) {
- var oakItem;
- if (bestChargeLevel === 0 && Skill.charges[i].skill === 226) { //initially set the first encountered oak sage skill as target
- bestChargeLevel = Skill.charges[i].level;
- oakItem = Skill.charges[i].unit;
- //print("best charge level initial: " + bestChargeLevel);
- continue;
- }
- if (Skill.charges[i].level > bestChargeLevel && Skill.charges[i].skill === 226) { //now compare each match on oaksage on skill level
- bestChargeLevel = Skill.charges[i].level;
- oakItem = Skill.charges[i].unit;
- //print("best charge level subsequent: " + bestchargelevel);
- continue;
- }
- }
- //print(JSON.stringify(oakItem));
- Skill.setSkill(226, 0, oakItem); //0 is right hand, charged skills always right
- Packet.castSkill(0, me.x, me.y); //cannot be skill.cast
- return true;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement