Addition of ranking skill bonuses.

This commit is contained in:
MobiusDevelopment
2020-01-01 23:19:34 +00:00
parent 0150feee05
commit e85db6c835
4 changed files with 738 additions and 50 deletions

View File

@@ -0,0 +1,145 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ai.others;
import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.instancemanager.RankManager;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.ListenerRegisterType;
import org.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
import org.l2jmobius.gameserver.model.events.annotations.RegisterType;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin;
import org.l2jmobius.gameserver.model.skills.Skill;
import ai.AbstractNpcAI;
/**
* @author Mobius
*/
public class RankingSkillBonuses extends AbstractNpcAI
{
// Skills
private static final Skill SERVER_LEVEL_RANKING_1ST_CLASS = SkillData.getInstance().getSkill(60003, 1);
private static final Skill SERVER_LEVEL_RANKING_2ND_CLASS = SkillData.getInstance().getSkill(60004, 1);
private static final Skill SERVER_LEVEL_RANKING_3RD_CLASS = SkillData.getInstance().getSkill(60005, 1);
private static final Skill HUMAN_LEVEL_RANKING_1ST_CLASS = SkillData.getInstance().getSkill(60006, 1);
private static final Skill ELF_LEVEL_RANKING_1ST_CLASS = SkillData.getInstance().getSkill(60007, 1);
private static final Skill DARK_ELF_LEVEL_RANKING_1ST_CLASS = SkillData.getInstance().getSkill(60008, 1);
private static final Skill ORC_LEVEL_RANKING_1ST_CLASS = SkillData.getInstance().getSkill(60009, 1);
private static final Skill DWARF_LEVEL_RANKING_1ST_CLASS = SkillData.getInstance().getSkill(60010, 1);
private static final Skill KAMAEL_LEVEL_RANKING_1ST_CLASS = SkillData.getInstance().getSkill(60011, 1);
private static final Skill SERVER_RANKING_BENEFIT_1 = SkillData.getInstance().getSkill(60012, 1);
private static final Skill SERVER_RANKING_BENEFIT_2 = SkillData.getInstance().getSkill(60013, 1);
private static final Skill SERVER_RANKING_BENEFIT_3 = SkillData.getInstance().getSkill(60014, 1);
private static final Skill RACE_RANKING_BENEFIT = SkillData.getInstance().getSkill(60015, 1);
@RegisterEvent(EventType.ON_PLAYER_LOGIN)
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
public void onPlayerLogin(OnPlayerLogin event)
{
final PlayerInstance player = event.getPlayer();
if (player == null)
{
return;
}
// Remove existing effects and skills.
player.getEffectList().stopSkillEffects(true, SERVER_LEVEL_RANKING_1ST_CLASS);
player.getEffectList().stopSkillEffects(true, SERVER_LEVEL_RANKING_2ND_CLASS);
player.getEffectList().stopSkillEffects(true, SERVER_LEVEL_RANKING_3RD_CLASS);
player.getEffectList().stopSkillEffects(true, HUMAN_LEVEL_RANKING_1ST_CLASS);
player.getEffectList().stopSkillEffects(true, ELF_LEVEL_RANKING_1ST_CLASS);
player.getEffectList().stopSkillEffects(true, DARK_ELF_LEVEL_RANKING_1ST_CLASS);
player.getEffectList().stopSkillEffects(true, ORC_LEVEL_RANKING_1ST_CLASS);
player.getEffectList().stopSkillEffects(true, DWARF_LEVEL_RANKING_1ST_CLASS);
player.getEffectList().stopSkillEffects(true, KAMAEL_LEVEL_RANKING_1ST_CLASS);
player.removeSkill(SERVER_RANKING_BENEFIT_1);
player.removeSkill(SERVER_RANKING_BENEFIT_2);
player.removeSkill(SERVER_RANKING_BENEFIT_3);
player.removeSkill(RACE_RANKING_BENEFIT);
// Add global rank skills.
int rank = RankManager.getInstance().getPlayerGlobalRank(player);
if (rank > 0)
{
if (rank <= 10)
{
SERVER_LEVEL_RANKING_1ST_CLASS.applyEffects(player, player);
player.addSkill(SERVER_RANKING_BENEFIT_1, false);
player.addSkill(SERVER_RANKING_BENEFIT_2, false);
player.addSkill(SERVER_RANKING_BENEFIT_3, false);
}
else if (rank <= 50)
{
SERVER_LEVEL_RANKING_2ND_CLASS.applyEffects(player, player);
player.addSkill(SERVER_RANKING_BENEFIT_2, false);
player.addSkill(SERVER_RANKING_BENEFIT_3, false);
}
else if (rank <= 100)
{
SERVER_LEVEL_RANKING_3RD_CLASS.applyEffects(player, player);
player.addSkill(SERVER_RANKING_BENEFIT_3, false);
}
}
// Apply race rank effects.
final int raceRank = RankManager.getInstance().getPlayerRaceRank(player);
if ((raceRank > 0) && (raceRank <= 10))
{
switch (player.getRace())
{
case HUMAN:
{
HUMAN_LEVEL_RANKING_1ST_CLASS.applyEffects(player, player);
break;
}
case ELF:
{
ELF_LEVEL_RANKING_1ST_CLASS.applyEffects(player, player);
break;
}
case DARK_ELF:
{
DARK_ELF_LEVEL_RANKING_1ST_CLASS.applyEffects(player, player);
break;
}
case ORC:
{
ORC_LEVEL_RANKING_1ST_CLASS.applyEffects(player, player);
break;
}
case DWARF:
{
DWARF_LEVEL_RANKING_1ST_CLASS.applyEffects(player, player);
break;
}
case KAMAEL:
{
KAMAEL_LEVEL_RANKING_1ST_CLASS.applyEffects(player, player);
break;
}
}
player.addSkill(RACE_RANKING_BENEFIT, false);
}
}
public static void main(String[] args)
{
new RankingSkillBonuses();
}
}

View File

@@ -15,76 +15,166 @@
<effectPoint>-100</effectPoint>
</skill>
<skill id="60003" toLevel="1" name="1st Place in the List of Ranks for Level on the Server">
<!-- Bonus for the 1st place in the list of ranks for level on the server.\nAll basic characteristics +1, HP Recovery Potions' Effect +50, Weight Limit +100,000, P. Evasion +20. -->
<!-- Bonus for the 1st place in the list of ranks for level on the server. All basic characteristics +1, HP Recovery Potions' Effect +50, Weight Limit +100,000, P. Evasion +20. -->
<icon>icon.server_ranking_1</icon>
<operateType>A1</operateType>
<isMagic>4</isMagic>
<effectPoint>1</effectPoint>
<isMagic>3</isMagic> <!-- Dance Skill -->
</skill>
<skill id="60004" toLevel="1" name="2nd Place in the List of Ranks for Level on the Server">
<!-- Bonus for 2nd-30th places in the list of ranks for level on the server.\nCON/ MEN/ DEX/ WIT/ +1, Weight Limit +10,000. -->
<!-- Bonus for 2nd-30th places in the list of ranks for level on the server. CON/ MEN/ DEX/ WIT/ +1, Weight Limit +10,000. -->
<icon>icon.server_ranking_2</icon>
<operateType>A1</operateType>
<isMagic>4</isMagic>
<effectPoint>1</effectPoint>
<isMagic>3</isMagic> <!-- Dance Skill -->
</skill>
<skill id="60005" toLevel="1" name="3rd Place in the List of Ranks for Level on the Server">
<!-- Bonus for 31-100th places in the list of ranks for level on the server.\nCON/ MEN/ +1, Weight Limit +5,000. -->
<!-- Bonus for 31-100th places in the list of ranks for level on the server. CON/ MEN/ +1, Weight Limit +5,000. -->
<icon>icon.server_ranking_3</icon>
<operateType>A1</operateType>
<isMagic>4</isMagic>
<effectPoint>1</effectPoint>
<isMagic>3</isMagic> <!-- Dance Skill -->
</skill>
<skill id="60006" toLevel="1" name="Human Level Ranking 1st Class">
<!-- Bonus for 1st place in the list of ranks for level among humans.\nP./ M. Critical Damage +300. -->
<!-- Bonus for 1st place in the list of ranks for level among humans. P./ M. Critical Damage +300. -->
<icon>icon.race_ranking_1</icon>
<operateType>A1</operateType>
<isMagic>4</isMagic>
<effectPoint>1</effectPoint>
<operateType>A2</operateType>
<effectPoint>100</effectPoint>
<basicProperty>NONE</basicProperty>
<magicCriticalRate>5</magicCriticalRate>
<specialLevel>-2</specialLevel>
<hitCancelTime>0</hitCancelTime>
<magicLvl>-2</magicLvl>
<abnormalLvl>1</abnormalLvl>
<abnormalTime>-1</abnormalTime>
<irreplacableBuff>true</irreplacableBuff>
<canBeDispelled>false</canBeDispelled>
<affectRange>1000</affectRange>
<affectLimit>50-50</affectLimit>
<isMagic>2</isMagic>
<targetType>SELF</targetType>
<affectScope>PLEDGE</affectScope>
<affectObject>FRIEND</affectObject>
</skill>
<skill id="60007" toLevel="1" name="Elf Level Ranking 1st Class">
<!-- Bonus for 1st place in the list of ranks for level among elves.\nP./ M. Atk. +300. -->
<!-- Bonus for 1st place in the list of ranks for level among elves. P./ M. Atk. +300. -->
<icon>icon.race_ranking_1</icon>
<operateType>A1</operateType>
<isMagic>4</isMagic>
<effectPoint>1</effectPoint>
<operateType>A2</operateType>
<effectPoint>100</effectPoint>
<basicProperty>NONE</basicProperty>
<magicCriticalRate>5</magicCriticalRate>
<specialLevel>-2</specialLevel>
<hitCancelTime>0</hitCancelTime>
<magicLvl>-2</magicLvl>
<abnormalLvl>1</abnormalLvl>
<abnormalTime>-1</abnormalTime>
<irreplacableBuff>true</irreplacableBuff>
<canBeDispelled>false</canBeDispelled>
<affectRange>1000</affectRange>
<affectLimit>50-50</affectLimit>
<isMagic>2</isMagic>
<targetType>SELF</targetType>
<affectScope>PLEDGE</affectScope>
<affectObject>FRIEND</affectObject>
</skill>
<skill id="60008" toLevel="1" name="Dark Elf Level Ranking 1st Class">
<!-- Bonus for 1st place in the list of ranks for level among dark elves.\nAtk. Spd./ Casting Spd. +200. -->
<!-- Bonus for 1st place in the list of ranks for level among dark elves. Atk. Spd./ Casting Spd. +200. -->
<icon>icon.race_ranking_1</icon>
<operateType>A1</operateType>
<isMagic>4</isMagic>
<effectPoint>1</effectPoint>
<operateType>A2</operateType>
<effectPoint>100</effectPoint>
<basicProperty>NONE</basicProperty>
<magicCriticalRate>5</magicCriticalRate>
<specialLevel>-2</specialLevel>
<hitCancelTime>0</hitCancelTime>
<magicLvl>-2</magicLvl>
<abnormalLvl>1</abnormalLvl>
<abnormalTime>-1</abnormalTime>
<irreplacableBuff>true</irreplacableBuff>
<canBeDispelled>false</canBeDispelled>
<affectRange>1000</affectRange>
<affectLimit>50-50</affectLimit>
<isMagic>2</isMagic>
<targetType>SELF</targetType>
<affectScope>PLEDGE</affectScope>
<affectObject>FRIEND</affectObject>
</skill>
<skill id="60009" toLevel="1" name="Orc Level Ranking 1st Class">
<!-- Bonus for 1st place in the list of ranks for level among orcs.\nP./ M. Critical Rate +20. -->
<!-- Bonus for 1st place in the list of ranks for level among orcs. P./ M. Critical Rate +20. -->
<icon>icon.race_ranking_1</icon>
<operateType>A1</operateType>
<isMagic>4</isMagic>
<effectPoint>1</effectPoint>
<operateType>A2</operateType>
<effectPoint>100</effectPoint>
<basicProperty>NONE</basicProperty>
<magicCriticalRate>5</magicCriticalRate>
<specialLevel>-2</specialLevel>
<hitCancelTime>0</hitCancelTime>
<magicLvl>-2</magicLvl>
<abnormalLvl>1</abnormalLvl>
<abnormalTime>-1</abnormalTime>
<irreplacableBuff>true</irreplacableBuff>
<canBeDispelled>false</canBeDispelled>
<affectRange>1000</affectRange>
<affectLimit>50-50</affectLimit>
<isMagic>2</isMagic>
<targetType>SELF</targetType>
<affectScope>PLEDGE</affectScope>
<affectObject>FRIEND</affectObject>
</skill>
<skill id="60010" toLevel="1" name="Dwarf Level Ranking 1st Class">
<!-- Bonus for 1st place in the list of ranks for level among dwarves. \nEnchant success rate is increased. -->
<!-- Bonus for 1st place in the list of ranks for level among dwarves. Enchant success rate is increased. -->
<icon>icon.race_ranking_1</icon>
<operateType>A1</operateType>
<isMagic>4</isMagic>
<effectPoint>1</effectPoint>
<operateType>A2</operateType>
<effectPoint>100</effectPoint>
<basicProperty>NONE</basicProperty>
<magicCriticalRate>5</magicCriticalRate>
<specialLevel>-2</specialLevel>
<hitCancelTime>0</hitCancelTime>
<magicLvl>-2</magicLvl>
<abnormalLvl>1</abnormalLvl>
<abnormalTime>-1</abnormalTime>
<irreplacableBuff>true</irreplacableBuff>
<canBeDispelled>false</canBeDispelled>
<affectRange>1000</affectRange>
<affectLimit>50-50</affectLimit>
<isMagic>2</isMagic>
<targetType>SELF</targetType>
<affectScope>PLEDGE</affectScope>
<affectObject>FRIEND</affectObject>
</skill>
<skill id="60011" toLevel="1" name="Kamael Level Ranking 1st Class">
<!-- Bonus for 1st place in the list of ranks for level among Kamael.\nP./ M. Accuracy, P./ M. Evasion +5. -->
<!-- Bonus for 1st place in the list of ranks for level among Kamael. P./ M. Accuracy, P./ M. Evasion +5. -->
<icon>icon.race_ranking_1</icon>
<operateType>A1</operateType>
<isMagic>4</isMagic>
<effectPoint>1</effectPoint>
<operateType>A2</operateType>
<effectPoint>100</effectPoint>
<basicProperty>NONE</basicProperty>
<magicCriticalRate>5</magicCriticalRate>
<specialLevel>-2</specialLevel>
<hitCancelTime>0</hitCancelTime>
<magicLvl>-2</magicLvl>
<abnormalLvl>1</abnormalLvl>
<abnormalTime>-1</abnormalTime>
<irreplacableBuff>true</irreplacableBuff>
<canBeDispelled>false</canBeDispelled>
<affectRange>1000</affectRange>
<affectLimit>50-50</affectLimit>
<isMagic>2</isMagic>
<targetType>SELF</targetType>
<affectScope>PLEDGE</affectScope>
<affectObject>FRIEND</affectObject>
</skill>
<skill id="60012" toLevel="1" name="Bonuses for 1st Rank on the Server">
<!-- CON/ MEN +1, Weight Limit +5,000. -->
<icon>icon.UI_server_ranking_1</icon>
<operateType>P</operateType>
<effects>
<effect name="StatUp">
<amount>1</amount>
<stat>CON</stat>
</effect>
<effect name="StatUp">
<amount>1</amount>
<stat>MEN</stat>
</effect>
</effects>
</skill>
<skill id="60013" toLevel="1" name="Bonuses for 2nd Rank on the Server">
<!-- DEX/ WIT +1, Weight Limit +5000. -->
<icon>icon.UI_server_ranking_2</icon>
<operateType>P</operateType>
</skill>
<skill id="60014" toLevel="1" name="Bonuses for 3rd Rank on the Server">
@@ -93,7 +183,7 @@
<operateType>P</operateType>
</skill>
<skill id="60015" toLevel="1" name="Bonus for Rank Among Races">
<!-- Humans: P./ M. Critical Damage is increased.\nElves: P./ M. Atk. is increased.\nDark Elves: Atk./ Casting Spd. is increased.\nOrc: P./ M. Critical Rate is increased.\nDwarves: Enchant success rate is increased.\nKamael: P./ M. Accuracy, P./ M. Evasion is increased. -->
<!-- Humans: P./ M. Critical Damage is increased. Elves: P./ M. Atk. is increased. Dark Elves: Atk./ Casting Spd. is increased. Orc: P./ M. Critical Rate is increased. Dwarves: Enchant success rate is increased. Kamael: P./ M. Accuracy, P./ M. Evasion is increased. -->
<icon>icon.UI_race_ranking_1</icon>
<operateType>P</operateType>
</skill>