diff --git a/scripts/gcw/gcwrank_imperial.py b/scripts/gcw/gcwrank_imperial.py new file mode 100644 index 00000000..e1021597 --- /dev/null +++ b/scripts/gcw/gcwrank_imperial.py @@ -0,0 +1,44 @@ +import sys +from resources.datatables import GcwRank + +def handleRankUp(actor, newrank): + if newrank > GcwRank.LIEUTENANT: + actor.addAbility('pvp_retaliation_ability') + + if newrank > GcwRank.CAPTAIN: + actor.addAbility('pvp_adrenaline_ability') + + if newrank > GcwRank.MAJOR: + actor.addAbility('pvp_unstoppable_ability') + + if newrank > GcwRank.LTCOLONEL: + actor.addAbility('pvp_last_man_ability') + + if newrank > GcwRank.COLONEL: + actor.addAbility('pvp_aura_buff_self_ability') + + if newrank > GcwRank.GENERAL: + actor.addAbility('pvp_airstrike_ability') + + return + +def handleRankDown(actor, newrank): + if newrank < GcwRank.LIEUTENANT: + actor.removeAbility('pvp_retaliation_ability') + + if newrank < GcwRank.CAPTAIN: + actor.removeAbility('pvp_adrenaline_ability') + + if newrank < GcwRank.MAJOR: + actor.removeAbility('pvp_unstoppable_ability') + + if newrank < GcwRank.LTCOLONEL: + actor.removeAbility('pvp_last_man_ability') + + if newrank < GcwRank.COLONEL: + actor.removeAbility('pvp_aura_buff_self_ability') + + if newrank < GcwRank.GENERAL: + actor.removeAbility('pvp_airstrike_ability') + + return \ No newline at end of file diff --git a/scripts/gcw/gcwrank_rebel.py b/scripts/gcw/gcwrank_rebel.py new file mode 100644 index 00000000..79f39731 --- /dev/null +++ b/scripts/gcw/gcwrank_rebel.py @@ -0,0 +1,44 @@ +import sys +from resources.datatables import GcwRank + +def handleRankUp(actor, newrank): + if newrank > GcwRank.LIEUTENANT: + actor.addAbility('pvp_retaliation_rebel_ability') + + if newrank > GcwRank.CAPTAIN: + actor.addAbility('pvp_adrenaline_rebel_ability') + + if newrank > GcwRank.MAJOR: + actor.addAbility('pvp_unstoppable_rebel_ability') + + if newrank > GcwRank.COMMANDER: + actor.addAbility('pvp_last_man_rebel_ability') + + if newrank > GcwRank.COLONEL: + actor.addAbility('pvp_aura_buff_self_rebel_ability') + + if newrank > GcwRank.GENERAL: + actor.addAbility('pvp_airstrike_rebel_ability') + + return + +def handleRankDown(actor, newrank): + if newrank < GcwRank.LIEUTENANT: + actor.removeAbility('pvp_retaliation_rebel_ability') + + if newrank < GcwRank.CAPTAIN: + actor.removeAbility('pvp_adrenaline_rebel_ability') + + if newrank < GcwRank.MAJOR: + actor.removeAbility('pvp_unstoppable_rebel_ability') + + if newrank < GcwRank.COMMANDER: + actor.removeAbility('pvp_last_man_rebel_ability') + + if newrank < GcwRank.COLONEL: + actor.removeAbility('pvp_aura_buff_self_rebel_ability') + + if newrank < GcwRank.GENERAL: + actor.removeAbility('pvp_airstrike_rebel_ability') + + return \ No newline at end of file diff --git a/src/resources/datatables/GcwRank.java b/src/resources/datatables/GcwRank.java new file mode 100644 index 00000000..fecac08a --- /dev/null +++ b/src/resources/datatables/GcwRank.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.datatables; + +public class GcwRank { + // Shared ranks + public static final int PRIVATE = 1; + public static final int SERGEANT = 4; + public static final int SERGEANTMAJOR = 6; + public static final int LIEUTENANT = 7; + public static final int CAPTAIN = 8; + public static final int MAJOR = 9; + public static final int COLONEL = 11; + public static final int GENERAL = 12; + + // Rebel ranks + public static final int TROOPER = 2; + public static final int HIGHTROOPER = 3; + public static final int SENIORSERGEANT = 5; + public static final int COMMANDER = 10; + + // Imperial ranks + public static final int CORPORAL = 2; + public static final int LANCECORPORAL = 3; + public static final int MASTERSERGEANT = 5; + public static final int LTCOLONEL = 10; + +} diff --git a/src/services/gcw/GCWService.java b/src/services/gcw/GCWService.java index 06dfa237..902f527c 100644 --- a/src/services/gcw/GCWService.java +++ b/src/services/gcw/GCWService.java @@ -555,6 +555,11 @@ public class GCWService implements INetworkDispatch { player.setCurrentRank(newrank); player.setRankProgress((float) Math.floor(newprogress)); + + if (newrank > oldrank) + core.scriptService.callScript("scripts/gcw/", "gcwrank_" + actor.getFaction(), "handleRankUp", actor, newrank); + else + core.scriptService.callScript("scripts/gcw/", "gcwrank_" + actor.getFaction(), "handleRankDown", actor, newrank); } public List getSFPlayers() {