From e38353e40966d641478768d3db490b183105179d Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 14 Nov 2015 16:31:37 +0000 Subject: [PATCH] Sync with L2jServer HighFive Nov 14th 2015. --- trunk/dist/game/config/Custom.ini | 2 +- .../CavernOfThePirateCaptainWorldDay60.xml | 2 +- .../CavernOfThePirateCaptainWorldDay83.xml | 2 +- .../CavernOfThePirateCaptainWorldNight60.xml | 2 +- .../data/instances/ChamberOfDelusionEast.xml | 2 +- .../data/instances/ChamberOfDelusionNorth.xml | 2 +- .../data/instances/ChamberOfDelusionSouth.xml | 2 +- .../instances/ChamberOfDelusionSquare.xml | 2 +- .../data/instances/ChamberOfDelusionTower.xml | 2 +- .../data/instances/ChamberOfDelusionWest.xml | 2 +- .../game/data/instances/CrystalCaverns.xml | 2 +- .../game/data/instances/DarkCloudMansion.xml | 2 +- .../dist/game/data/instances/DemonPrince.xml | 2 +- .../instances/DisciplesNecropolisPast.xml | 2 +- .../dist/game/data/instances/ElcadiasTent.xml | 2 +- .../data/instances/FaeronTrainingGrounds1.xml | 2 +- .../data/instances/FaeronTrainingGrounds2.xml | 2 +- .../game/data/instances/FinalEmperialTomb.xml | 2 +- .../game/data/instances/HallOfSuffering.xml | 2 +- .../data/instances/HarnakUndergroundRuins.xml | 2 +- .../game/data/instances/HideoutOfTheDawn.xml | 2 +- .../game/data/instances/IceQueensCastle.xml | 2 +- .../instances/IceQueensCastleBattleEasy.xml | 2 +- .../IceQueensCastleBattleHardcore.xml | 2 +- .../data/instances/JiniaGuildHideout1.xml | 2 +- .../data/instances/JiniaGuildHideout2.xml | 2 +- .../data/instances/JiniaGuildHideout3.xml | 2 +- .../data/instances/JiniaGuildHideout4.xml | 2 +- .../game/data/instances/KaraphonHabitat.xml | 2 +- .../game/data/instances/LabyrinthOfBelis.xml | 2 +- .../game/data/instances/LibraryOfSages.xml | 2 +- .../dist/game/data/instances/MithrilMine.xml | 2 +- .../data/instances/MonasteryOfSilence.xml | 2 +- .../game/data/instances/MuseumDungeon.xml | 2 +- .../game/data/instances/NornilsGarden.xml | 2 +- .../data/instances/PailakaDevilsLegacy.xml | 2 +- .../data/instances/PailakaInjuredDragon.xml | 2 +- .../instances/PailakaSongOfIceAndFire.xml | 2 +- trunk/dist/game/data/instances/PartyDuel.xml | 31 + trunk/dist/game/data/instances/Ranku.xml | 2 +- .../instances/SanctumoftheLordsofDawn.xml | 2 +- trunk/dist/game/data/instances/SecretArea.xml | 2 +- .../instances/SeedOfDestructionStage1.xml | 2 +- trunk/dist/game/data/instances/UrbanArea.xml | 2 +- .../scripts/handlers/EffectMasterHandler.java | 5 +- .../{Invincible.java => BlockBuff.java} | 15 +- .../{Petrification.java => BlockDamage.java} | 33 +- .../handlers/effecthandlers/BlockDebuff.java | 48 + .../instances/ChambersOfDelusion/Chamber.java | 2 +- .../scripts/instances/Kamaloka/Kamaloka.java | 4 +- .../NornilsGarden/NornilsGarden.java | 2 +- .../Q00511_AwlUnderFoot.java | 2 +- .../game/data/stats/skills/00200-00299.xml | 12 +- .../game/data/stats/skills/00300-00399.xml | 19 +- .../game/data/stats/skills/00400-00499.xml | 24 +- .../game/data/stats/skills/00600-00699.xml | 3 + .../game/data/stats/skills/00800-00899.xml | 11 +- .../game/data/stats/skills/01300-01399.xml | 2 - .../game/data/stats/skills/01400-01499.xml | 34 +- .../game/data/stats/skills/01500-01599.xml | 21 +- .../game/data/stats/skills/02200-02299.xml | 13 +- .../game/data/stats/skills/02300-02399.xml | 13 +- .../game/data/stats/skills/02500-02599.xml | 11 +- .../game/data/stats/skills/02900-02999.xml | 11 +- .../game/data/stats/skills/03000-03099.xml | 13 +- .../game/data/stats/skills/03100-03199.xml | 46 +- .../game/data/stats/skills/04100-04199.xml | 15 +- .../game/data/stats/skills/04300-04399.xml | 21 +- .../game/data/stats/skills/04500-04599.xml | 26 +- .../game/data/stats/skills/04600-04699.xml | 15 +- .../game/data/stats/skills/05100-05199.xml | 13 +- .../game/data/stats/skills/05200-05299.xml | 11 +- .../game/data/stats/skills/05500-05599.xml | 11 +- .../game/data/stats/skills/05700-05799.xml | 8 +- .../game/data/stats/skills/05900-05999.xml | 11 +- .../game/data/stats/skills/06000-06099.xml | 14 +- .../game/data/stats/skills/06400-06499.xml | 13 +- .../game/data/stats/skills/06700-06799.xml | 26 +- .../game/data/stats/skills/06800-06899.xml | 29 +- .../game/data/stats/skills/10000-10099.xml | 2 +- .../game/data/stats/skills/10200-10299.xml | 24 +- .../game/data/stats/skills/11000-11099.xml | 33 +- .../game/data/stats/skills/11500-11599.xml | 78 +- .../game/data/stats/skills/11700-11799.xml | 34 +- .../game/data/stats/skills/21000-21099.xml | 11 +- .../game/data/stats/skills/21200-21299.xml | 8 +- .../game/data/stats/skills/23100-23199.xml | 16 +- .../game/data/stats/skills/26100-26199.xml | 15 +- trunk/dist/game/data/xsd/instance.xsd | 44 +- trunk/dist/game/data/xsd/skills.xsd | 194 +++- .../gameserver/ai/L2AttackableAI.java | 9 +- .../gameserver/ai/L2ControllableMobAI.java | 2 +- .../gameserver/ai/L2FortSiegeGuardAI.java | 4 +- .../l2jserver/gameserver/ai/L2PlayerAI.java | 10 +- .../gameserver/ai/L2SiegeGuardAI.java | 4 +- .../data/xml/impl/SkillTreesData.java | 2 +- .../gameserver/enums/DuelResult.java | 17 +- .../l2jserver/gameserver/enums/DuelState.java | 31 + .../gameserver/enums/StartPosType.java | 28 + .../instancemanager/DuelManager.java | 111 +- .../instancemanager/MapRegionManager.java | 2 +- .../l2jserver/gameserver/model/L2Party.java | 10 - .../gameserver/model/actor/L2Character.java | 22 +- .../model/actor/instance/L2CubicInstance.java | 4 +- .../model/actor/instance/L2PcInstance.java | 117 +- .../actor/instance/L2ServitorInstance.java | 34 - .../actor/instance/L2SiegeFlagInstance.java | 4 +- .../model/actor/instance/L2TrapInstance.java | 2 +- .../model/actor/status/CharStatus.java | 2 +- .../model/actor/status/NpcStatus.java | 4 +- .../model/actor/status/PcStatus.java | 13 +- .../model/actor/status/SummonStatus.java | 4 +- .../gameserver/model/effects/EffectFlag.java | 5 +- .../model/effects/L2EffectType.java | 5 +- .../gameserver/model/entity/Duel.java | 1011 ++++++----------- .../gameserver/model/entity/Instance.java | 496 ++++---- .../model/entity/TvTEventTeleporter.java | 5 +- .../gameserver/model/skills/Skill.java | 15 + .../gameserver/model/stats/Formulas.java | 12 +- .../gameserver/model/stats/Stats.java | 2 - .../network/L2GamePacketHandler.java | 1 - .../network/clientpackets/Action.java | 8 + .../clientpackets/RequestActionUse.java | 215 ++-- .../clientpackets/RequestDuelAnswerStart.java | 2 +- .../clientpackets/RequestDuelStart.java | 71 +- 125 files changed, 1998 insertions(+), 1419 deletions(-) create mode 100644 trunk/dist/game/data/instances/PartyDuel.xml rename trunk/dist/game/data/scripts/handlers/effecthandlers/{Invincible.java => BlockBuff.java} (73%) rename trunk/dist/game/data/scripts/handlers/effecthandlers/{Petrification.java => BlockDamage.java} (63%) create mode 100644 trunk/dist/game/data/scripts/handlers/effecthandlers/BlockDebuff.java create mode 100644 trunk/java/com/l2jserver/gameserver/enums/DuelState.java create mode 100644 trunk/java/com/l2jserver/gameserver/enums/StartPosType.java diff --git a/trunk/dist/game/config/Custom.ini b/trunk/dist/game/config/Custom.ini index ed1ed217b8..0d1453428b 100644 --- a/trunk/dist/game/config/Custom.ini +++ b/trunk/dist/game/config/Custom.ini @@ -25,7 +25,7 @@ ChampionAura = True # Min and max levels allowed for a mob to be a Champion mob. ChampionMinLevel = 20 -ChampionMaxLevel = 70 +ChampionMaxLevel = 85 # Hp multiplier for Champion mobs. ChampionHp = 8 diff --git a/trunk/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml b/trunk/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml index fb1d9c6bc9..eaac7a1633 100644 --- a/trunk/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml +++ b/trunk/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml b/trunk/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml index c4b67e2a43..8f04e1f5be 100644 --- a/trunk/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml +++ b/trunk/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/CavernOfThePirateCaptainWorldNight60.xml b/trunk/dist/game/data/instances/CavernOfThePirateCaptainWorldNight60.xml index 13a4aa361d..5d00954f32 100644 --- a/trunk/dist/game/data/instances/CavernOfThePirateCaptainWorldNight60.xml +++ b/trunk/dist/game/data/instances/CavernOfThePirateCaptainWorldNight60.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/ChamberOfDelusionEast.xml b/trunk/dist/game/data/instances/ChamberOfDelusionEast.xml index 9bfe3b60de..835876a736 100644 --- a/trunk/dist/game/data/instances/ChamberOfDelusionEast.xml +++ b/trunk/dist/game/data/instances/ChamberOfDelusionEast.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/ChamberOfDelusionNorth.xml b/trunk/dist/game/data/instances/ChamberOfDelusionNorth.xml index 5a77c0a37d..0195d3f366 100644 --- a/trunk/dist/game/data/instances/ChamberOfDelusionNorth.xml +++ b/trunk/dist/game/data/instances/ChamberOfDelusionNorth.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/ChamberOfDelusionSouth.xml b/trunk/dist/game/data/instances/ChamberOfDelusionSouth.xml index 2aa619194d..26bcd503bf 100644 --- a/trunk/dist/game/data/instances/ChamberOfDelusionSouth.xml +++ b/trunk/dist/game/data/instances/ChamberOfDelusionSouth.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/ChamberOfDelusionSquare.xml b/trunk/dist/game/data/instances/ChamberOfDelusionSquare.xml index e42eb105e6..a4d4f86491 100644 --- a/trunk/dist/game/data/instances/ChamberOfDelusionSquare.xml +++ b/trunk/dist/game/data/instances/ChamberOfDelusionSquare.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/ChamberOfDelusionTower.xml b/trunk/dist/game/data/instances/ChamberOfDelusionTower.xml index f2869cf4d6..628785fe79 100644 --- a/trunk/dist/game/data/instances/ChamberOfDelusionTower.xml +++ b/trunk/dist/game/data/instances/ChamberOfDelusionTower.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/ChamberOfDelusionWest.xml b/trunk/dist/game/data/instances/ChamberOfDelusionWest.xml index d4718f9ff4..367c37c583 100644 --- a/trunk/dist/game/data/instances/ChamberOfDelusionWest.xml +++ b/trunk/dist/game/data/instances/ChamberOfDelusionWest.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/CrystalCaverns.xml b/trunk/dist/game/data/instances/CrystalCaverns.xml index 96498a1b62..8cb787ede3 100644 --- a/trunk/dist/game/data/instances/CrystalCaverns.xml +++ b/trunk/dist/game/data/instances/CrystalCaverns.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/DarkCloudMansion.xml b/trunk/dist/game/data/instances/DarkCloudMansion.xml index d3dcd09512..6f7f6d624b 100644 --- a/trunk/dist/game/data/instances/DarkCloudMansion.xml +++ b/trunk/dist/game/data/instances/DarkCloudMansion.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/DemonPrince.xml b/trunk/dist/game/data/instances/DemonPrince.xml index c05daa72a4..d08ba88a64 100644 --- a/trunk/dist/game/data/instances/DemonPrince.xml +++ b/trunk/dist/game/data/instances/DemonPrince.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/DisciplesNecropolisPast.xml b/trunk/dist/game/data/instances/DisciplesNecropolisPast.xml index 45bc3b8a20..5779739f6a 100644 --- a/trunk/dist/game/data/instances/DisciplesNecropolisPast.xml +++ b/trunk/dist/game/data/instances/DisciplesNecropolisPast.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/ElcadiasTent.xml b/trunk/dist/game/data/instances/ElcadiasTent.xml index 9c68d68d48..9525d3ca23 100644 --- a/trunk/dist/game/data/instances/ElcadiasTent.xml +++ b/trunk/dist/game/data/instances/ElcadiasTent.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/FaeronTrainingGrounds1.xml b/trunk/dist/game/data/instances/FaeronTrainingGrounds1.xml index 26cab55968..9d962c6c07 100644 --- a/trunk/dist/game/data/instances/FaeronTrainingGrounds1.xml +++ b/trunk/dist/game/data/instances/FaeronTrainingGrounds1.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/FaeronTrainingGrounds2.xml b/trunk/dist/game/data/instances/FaeronTrainingGrounds2.xml index e6fed6b048..fa6911a3b3 100644 --- a/trunk/dist/game/data/instances/FaeronTrainingGrounds2.xml +++ b/trunk/dist/game/data/instances/FaeronTrainingGrounds2.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/FinalEmperialTomb.xml b/trunk/dist/game/data/instances/FinalEmperialTomb.xml index 0866bf125c..79607535a8 100644 --- a/trunk/dist/game/data/instances/FinalEmperialTomb.xml +++ b/trunk/dist/game/data/instances/FinalEmperialTomb.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/HallOfSuffering.xml b/trunk/dist/game/data/instances/HallOfSuffering.xml index 928b4a323e..a061129ace 100644 --- a/trunk/dist/game/data/instances/HallOfSuffering.xml +++ b/trunk/dist/game/data/instances/HallOfSuffering.xml @@ -4,5 +4,5 @@ - + \ No newline at end of file diff --git a/trunk/dist/game/data/instances/HarnakUndergroundRuins.xml b/trunk/dist/game/data/instances/HarnakUndergroundRuins.xml index 539a08e7df..be1152d1a5 100644 --- a/trunk/dist/game/data/instances/HarnakUndergroundRuins.xml +++ b/trunk/dist/game/data/instances/HarnakUndergroundRuins.xml @@ -4,7 +4,7 @@ - + diff --git a/trunk/dist/game/data/instances/HideoutOfTheDawn.xml b/trunk/dist/game/data/instances/HideoutOfTheDawn.xml index 8e4d8fbd20..2bafa5fe16 100644 --- a/trunk/dist/game/data/instances/HideoutOfTheDawn.xml +++ b/trunk/dist/game/data/instances/HideoutOfTheDawn.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/IceQueensCastle.xml b/trunk/dist/game/data/instances/IceQueensCastle.xml index 3d8e707812..1e3d349039 100644 --- a/trunk/dist/game/data/instances/IceQueensCastle.xml +++ b/trunk/dist/game/data/instances/IceQueensCastle.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/IceQueensCastleBattleEasy.xml b/trunk/dist/game/data/instances/IceQueensCastleBattleEasy.xml index 8c861857b2..43c66f7c3c 100644 --- a/trunk/dist/game/data/instances/IceQueensCastleBattleEasy.xml +++ b/trunk/dist/game/data/instances/IceQueensCastleBattleEasy.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/IceQueensCastleBattleHardcore.xml b/trunk/dist/game/data/instances/IceQueensCastleBattleHardcore.xml index 19678e8dbc..78653ff529 100644 --- a/trunk/dist/game/data/instances/IceQueensCastleBattleHardcore.xml +++ b/trunk/dist/game/data/instances/IceQueensCastleBattleHardcore.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/JiniaGuildHideout1.xml b/trunk/dist/game/data/instances/JiniaGuildHideout1.xml index 6ff421a2f9..8aef365b53 100644 --- a/trunk/dist/game/data/instances/JiniaGuildHideout1.xml +++ b/trunk/dist/game/data/instances/JiniaGuildHideout1.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/JiniaGuildHideout2.xml b/trunk/dist/game/data/instances/JiniaGuildHideout2.xml index ac11115308..31d2126f50 100644 --- a/trunk/dist/game/data/instances/JiniaGuildHideout2.xml +++ b/trunk/dist/game/data/instances/JiniaGuildHideout2.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/JiniaGuildHideout3.xml b/trunk/dist/game/data/instances/JiniaGuildHideout3.xml index ac11115308..31d2126f50 100644 --- a/trunk/dist/game/data/instances/JiniaGuildHideout3.xml +++ b/trunk/dist/game/data/instances/JiniaGuildHideout3.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/JiniaGuildHideout4.xml b/trunk/dist/game/data/instances/JiniaGuildHideout4.xml index ac11115308..31d2126f50 100644 --- a/trunk/dist/game/data/instances/JiniaGuildHideout4.xml +++ b/trunk/dist/game/data/instances/JiniaGuildHideout4.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/KaraphonHabitat.xml b/trunk/dist/game/data/instances/KaraphonHabitat.xml index 59569b6cd6..ee4b5546e5 100644 --- a/trunk/dist/game/data/instances/KaraphonHabitat.xml +++ b/trunk/dist/game/data/instances/KaraphonHabitat.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/LabyrinthOfBelis.xml b/trunk/dist/game/data/instances/LabyrinthOfBelis.xml index dd7bcfa597..b6415b5725 100644 --- a/trunk/dist/game/data/instances/LabyrinthOfBelis.xml +++ b/trunk/dist/game/data/instances/LabyrinthOfBelis.xml @@ -2,7 +2,7 @@ - + diff --git a/trunk/dist/game/data/instances/LibraryOfSages.xml b/trunk/dist/game/data/instances/LibraryOfSages.xml index 0b2bbb2b0b..634693e282 100644 --- a/trunk/dist/game/data/instances/LibraryOfSages.xml +++ b/trunk/dist/game/data/instances/LibraryOfSages.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/MithrilMine.xml b/trunk/dist/game/data/instances/MithrilMine.xml index 13ce8d9808..8a904af402 100644 --- a/trunk/dist/game/data/instances/MithrilMine.xml +++ b/trunk/dist/game/data/instances/MithrilMine.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/MonasteryOfSilence.xml b/trunk/dist/game/data/instances/MonasteryOfSilence.xml index 612b071325..41bce3b7af 100644 --- a/trunk/dist/game/data/instances/MonasteryOfSilence.xml +++ b/trunk/dist/game/data/instances/MonasteryOfSilence.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/MuseumDungeon.xml b/trunk/dist/game/data/instances/MuseumDungeon.xml index 93e8acd9e3..a1f05b6d2c 100644 --- a/trunk/dist/game/data/instances/MuseumDungeon.xml +++ b/trunk/dist/game/data/instances/MuseumDungeon.xml @@ -2,7 +2,7 @@ - + diff --git a/trunk/dist/game/data/instances/NornilsGarden.xml b/trunk/dist/game/data/instances/NornilsGarden.xml index e33d9c943b..f710a1bec5 100644 --- a/trunk/dist/game/data/instances/NornilsGarden.xml +++ b/trunk/dist/game/data/instances/NornilsGarden.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/PailakaDevilsLegacy.xml b/trunk/dist/game/data/instances/PailakaDevilsLegacy.xml index b7a5512097..d7623099c0 100644 --- a/trunk/dist/game/data/instances/PailakaDevilsLegacy.xml +++ b/trunk/dist/game/data/instances/PailakaDevilsLegacy.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/PailakaInjuredDragon.xml b/trunk/dist/game/data/instances/PailakaInjuredDragon.xml index f42c0d3931..dbcaffce5f 100644 --- a/trunk/dist/game/data/instances/PailakaInjuredDragon.xml +++ b/trunk/dist/game/data/instances/PailakaInjuredDragon.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/PailakaSongOfIceAndFire.xml b/trunk/dist/game/data/instances/PailakaSongOfIceAndFire.xml index 1c88acc89f..ddc7f44028 100644 --- a/trunk/dist/game/data/instances/PailakaSongOfIceAndFire.xml +++ b/trunk/dist/game/data/instances/PailakaSongOfIceAndFire.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/PartyDuel.xml b/trunk/dist/game/data/instances/PartyDuel.xml new file mode 100644 index 0000000000..ca1ad7bd97 --- /dev/null +++ b/trunk/dist/game/data/instances/PartyDuel.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/trunk/dist/game/data/instances/Ranku.xml b/trunk/dist/game/data/instances/Ranku.xml index f8aa5483e8..068d84b6b6 100644 --- a/trunk/dist/game/data/instances/Ranku.xml +++ b/trunk/dist/game/data/instances/Ranku.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/SanctumoftheLordsofDawn.xml b/trunk/dist/game/data/instances/SanctumoftheLordsofDawn.xml index 248109da20..44b3f551e7 100644 --- a/trunk/dist/game/data/instances/SanctumoftheLordsofDawn.xml +++ b/trunk/dist/game/data/instances/SanctumoftheLordsofDawn.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/SecretArea.xml b/trunk/dist/game/data/instances/SecretArea.xml index fbf7e14489..306e824a2c 100644 --- a/trunk/dist/game/data/instances/SecretArea.xml +++ b/trunk/dist/game/data/instances/SecretArea.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/SeedOfDestructionStage1.xml b/trunk/dist/game/data/instances/SeedOfDestructionStage1.xml index b1d4d49977..81eb19ea12 100644 --- a/trunk/dist/game/data/instances/SeedOfDestructionStage1.xml +++ b/trunk/dist/game/data/instances/SeedOfDestructionStage1.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/instances/UrbanArea.xml b/trunk/dist/game/data/instances/UrbanArea.xml index 0a1658d8ce..d7150f4236 100644 --- a/trunk/dist/game/data/instances/UrbanArea.xml +++ b/trunk/dist/game/data/instances/UrbanArea.xml @@ -3,7 +3,7 @@ - + diff --git a/trunk/dist/game/data/scripts/handlers/EffectMasterHandler.java b/trunk/dist/game/data/scripts/handlers/EffectMasterHandler.java index 7d4afb1924..ce29f95cb9 100644 --- a/trunk/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/trunk/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -42,7 +42,10 @@ public final class EffectMasterHandler Betray.class, Blink.class, BlockAction.class, + BlockBuff.class, BlockChat.class, + BlockDamage.class, + BlockDebuff.class, BlockParty.class, BlockBuffSlot.class, BlockResurrection.class, @@ -112,7 +115,6 @@ public final class EffectMasterHandler IgnoreDeath.class, ImmobileBuff.class, ImmobilePetBuff.class, - Invincible.class, JumpToFriend.class, KnockBack.class, KnockDown.class, @@ -139,7 +141,6 @@ public final class EffectMasterHandler OpenDwarfRecipeBook.class, Paralyze.class, Passive.class, - Petrification.class, PhysicalAttack.class, PhysicalAttackHpLink.class, PhysicalAttackMute.class, diff --git a/trunk/dist/game/data/scripts/handlers/effecthandlers/Invincible.java b/trunk/dist/game/data/scripts/handlers/effecthandlers/BlockBuff.java similarity index 73% rename from trunk/dist/game/data/scripts/handlers/effecthandlers/Invincible.java rename to trunk/dist/game/data/scripts/handlers/effecthandlers/BlockBuff.java index 72b5615722..50a3e834ad 100644 --- a/trunk/dist/game/data/scripts/handlers/effecthandlers/Invincible.java +++ b/trunk/dist/game/data/scripts/handlers/effecthandlers/BlockBuff.java @@ -22,13 +22,14 @@ import com.l2jserver.gameserver.model.StatsSet; import com.l2jserver.gameserver.model.conditions.Condition; import com.l2jserver.gameserver.model.effects.AbstractEffect; import com.l2jserver.gameserver.model.effects.EffectFlag; +import com.l2jserver.gameserver.model.effects.L2EffectType; /** - * Invincible effect implementation. + * @author Zealar */ -public final class Invincible extends AbstractEffect +public final class BlockBuff extends AbstractEffect { - public Invincible(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) + public BlockBuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); } @@ -36,6 +37,12 @@ public final class Invincible extends AbstractEffect @Override public int getEffectFlags() { - return EffectFlag.INVUL.getMask(); + return EffectFlag.BLOCK_BUFF.getMask(); + } + + @Override + public L2EffectType getEffectType() + { + return L2EffectType.BLOCK_BUFF; } } diff --git a/trunk/dist/game/data/scripts/handlers/effecthandlers/Petrification.java b/trunk/dist/game/data/scripts/handlers/effecthandlers/BlockDamage.java similarity index 63% rename from trunk/dist/game/data/scripts/handlers/effecthandlers/Petrification.java rename to trunk/dist/game/data/scripts/handlers/effecthandlers/BlockDamage.java index 258e8680c5..db05be1309 100644 --- a/trunk/dist/game/data/scripts/handlers/effecthandlers/Petrification.java +++ b/trunk/dist/game/data/scripts/handlers/effecthandlers/BlockDamage.java @@ -18,41 +18,40 @@ */ package handlers.effecthandlers; -import com.l2jserver.gameserver.ai.CtrlEvent; import com.l2jserver.gameserver.model.StatsSet; import com.l2jserver.gameserver.model.conditions.Condition; import com.l2jserver.gameserver.model.effects.AbstractEffect; import com.l2jserver.gameserver.model.effects.EffectFlag; -import com.l2jserver.gameserver.model.skills.BuffInfo; +import com.l2jserver.gameserver.model.effects.L2EffectType; /** - * Petrification effect implementation. + * @author Zealar */ -public final class Petrification extends AbstractEffect +public final class BlockDamage extends AbstractEffect { - public Petrification(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) + public enum BlockType + { + HP, + MP + } + + private final BlockType _type; + + public BlockDamage(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) { super(attachCond, applyCond, set, params); + _type = params.getEnum("type", BlockType.class, BlockType.HP); } @Override public int getEffectFlags() { - return EffectFlag.PARALYZED.getMask() | EffectFlag.INVUL.getMask(); + return _type == BlockType.HP ? EffectFlag.BLOCK_HP.getMask() : EffectFlag.BLOCK_MP.getMask(); } @Override - public void onExit(BuffInfo info) + public L2EffectType getEffectType() { - if (!info.getEffected().isPlayer()) - { - info.getEffected().getAI().notifyEvent(CtrlEvent.EVT_THINK); - } - } - - @Override - public void onStart(BuffInfo info) - { - info.getEffected().startParalyze(); + return L2EffectType.BLOCK_DAMAGE; } } diff --git a/trunk/dist/game/data/scripts/handlers/effecthandlers/BlockDebuff.java b/trunk/dist/game/data/scripts/handlers/effecthandlers/BlockDebuff.java new file mode 100644 index 0000000000..1dba6de1ea --- /dev/null +++ b/trunk/dist/game/data/scripts/handlers/effecthandlers/BlockDebuff.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2004-2015 L2J DataPack + * + * This file is part of L2J DataPack. + * + * L2J DataPack 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. + * + * L2J DataPack 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 . + */ +package handlers.effecthandlers; + +import com.l2jserver.gameserver.model.StatsSet; +import com.l2jserver.gameserver.model.conditions.Condition; +import com.l2jserver.gameserver.model.effects.AbstractEffect; +import com.l2jserver.gameserver.model.effects.EffectFlag; +import com.l2jserver.gameserver.model.effects.L2EffectType; + +/** + * @author Zealar + */ +public final class BlockDebuff extends AbstractEffect +{ + public BlockDebuff(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) + { + super(attachCond, applyCond, set, params); + } + + @Override + public int getEffectFlags() + { + return EffectFlag.BLOCK_DEBUFF.getMask(); + } + + @Override + public L2EffectType getEffectType() + { + return L2EffectType.BLOCK_DEBUFF; + } +} diff --git a/trunk/dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java b/trunk/dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java index 97f1be488b..35d53ad681 100644 --- a/trunk/dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java +++ b/trunk/dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java @@ -425,7 +425,7 @@ public abstract class Chamber extends AbstractInstance return; } final Instance inst = InstanceManager.getInstance().getInstance(player.getInstanceId()); - Location ret = inst.getSpawnLoc(); + Location ret = inst.getExitLoc(); final String return_point = player.getVariables().getString(RETURN, null); if (return_point != null) { diff --git a/trunk/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java b/trunk/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java index 6dd97fdbcf..4e0d69fab1 100644 --- a/trunk/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java +++ b/trunk/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java @@ -1386,7 +1386,7 @@ public final class Kamaloka extends AbstractInstance // set name for the kamaloka inst.setName(InstanceManager.getInstance().getInstanceIdName(templateId)); // set return location - inst.setSpawnLoc(new Location(player)); + inst.setExitLoc(new Location(player)); // disable summon friend into instance inst.setAllowSummon(false); // set duration and empty destroy time @@ -1577,7 +1577,7 @@ public final class Kamaloka extends AbstractInstance { if ((partyMember != null) && (partyMember.getInstanceId() == world.getInstanceId())) { - teleportPlayer(partyMember, inst.getSpawnLoc(), 0); + teleportPlayer(partyMember, inst.getExitLoc(), 0); } } } diff --git a/trunk/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java b/trunk/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java index 37e70d85f0..ced70750ab 100644 --- a/trunk/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java +++ b/trunk/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java @@ -282,7 +282,7 @@ public final class NornilsGarden extends AbstractInstance final Instance inst = InstanceManager.getInstance().getInstance(instanceId); inst.setName(InstanceManager.getInstance().getInstanceIdName(TEMPLATE_ID)); - inst.setSpawnLoc(new Location(player)); + inst.setExitLoc(new Location(player)); inst.setAllowSummon(false); inst.setDuration(DURATION_TIME * 60000); inst.setEmptyDestroyTime(EMPTY_DESTROY_TIME * 60000); diff --git a/trunk/dist/game/data/scripts/quests/Q00511_AwlUnderFoot/Q00511_AwlUnderFoot.java b/trunk/dist/game/data/scripts/quests/Q00511_AwlUnderFoot/Q00511_AwlUnderFoot.java index 9519443c6d..f67119546b 100644 --- a/trunk/dist/game/data/scripts/quests/Q00511_AwlUnderFoot/Q00511_AwlUnderFoot.java +++ b/trunk/dist/game/data/scripts/quests/Q00511_AwlUnderFoot/Q00511_AwlUnderFoot.java @@ -290,7 +290,7 @@ public final class Q00511_AwlUnderFoot extends Quest L2Party party = player.getParty(); int instanceId = InstanceManager.getInstance().createDynamicInstance(template); Instance ins = InstanceManager.getInstance().getInstance(instanceId); - ins.setSpawnLoc(new Location(player)); + ins.setExitLoc(new Location(player)); world = new FAUWorld(); world.setInstanceId(instanceId); world.setTemplateId(dungeon.getInstanceId()); diff --git a/trunk/dist/game/data/stats/skills/00200-00299.xml b/trunk/dist/game/data/stats/skills/00200-00299.xml index b0c8eed662..386e83487d 100644 --- a/trunk/dist/game/data/stats/skills/00200-00299.xml +++ b/trunk/dist/game/data/stats/skills/00200-00299.xml @@ -1031,7 +1031,6 @@ - @@ -1624,6 +1623,7 @@ 1 3 5 6 8 10 11 13 15 16 18 20 21 23 25 26 28 30 31 33 35 36 38 40 41 43 45 46 48 50 52 54 56
76 76 76 77 77 77 78 78 78 79 79 79 80 80 80 81 81 81 82 82 82 83 83 83 84 84 84 85 85 85 85 85 85
+ @@ -1655,7 +1655,10 @@ - + + + + @@ -2319,7 +2322,7 @@ - + @@ -2665,6 +2668,9 @@ + + +
diff --git a/trunk/dist/game/data/stats/skills/00300-00399.xml b/trunk/dist/game/data/stats/skills/00300-00399.xml index 1d73c077e8..bd872b62e0 100644 --- a/trunk/dist/game/data/stats/skills/00300-00399.xml +++ b/trunk/dist/game/data/stats/skills/00300-00399.xml @@ -1487,7 +1487,7 @@ - + @@ -2470,7 +2470,18 @@ - + + + + + + + + + + + + @@ -2853,7 +2864,6 @@ - 0.7 0.5 0.4 0.3 0.2
0.88 0.8 0.76 0.72 0.68
@@ -2940,10 +2950,9 @@ - + - diff --git a/trunk/dist/game/data/stats/skills/00400-00499.xml b/trunk/dist/game/data/stats/skills/00400-00499.xml index cd2ccf0078..88200e31f1 100644 --- a/trunk/dist/game/data/stats/skills/00400-00499.xml +++ b/trunk/dist/game/data/stats/skills/00400-00499.xml @@ -1167,7 +1167,6 @@
- @@ -1642,7 +1641,16 @@ - + + + + + + + + + + @@ -1667,7 +1675,16 @@ - + + + + + + + + + + @@ -2676,7 +2693,6 @@ 7 10
32 43
- diff --git a/trunk/dist/game/data/stats/skills/00600-00699.xml b/trunk/dist/game/data/stats/skills/00600-00699.xml index f4454c2d64..c05499d0ff 100644 --- a/trunk/dist/game/data/stats/skills/00600-00699.xml +++ b/trunk/dist/game/data/stats/skills/00600-00699.xml @@ -901,6 +901,9 @@ + + +
diff --git a/trunk/dist/game/data/stats/skills/00800-00899.xml b/trunk/dist/game/data/stats/skills/00800-00899.xml index 5a2acc4333..31bc19c006 100644 --- a/trunk/dist/game/data/stats/skills/00800-00899.xml +++ b/trunk/dist/game/data/stats/skills/00800-00899.xml @@ -865,7 +865,13 @@ - + + + + + + + @@ -1042,6 +1048,9 @@ + + + diff --git a/trunk/dist/game/data/stats/skills/01300-01399.xml b/trunk/dist/game/data/stats/skills/01300-01399.xml index f0232cec3a..37e0c52f6b 100644 --- a/trunk/dist/game/data/stats/skills/01300-01399.xml +++ b/trunk/dist/game/data/stats/skills/01300-01399.xml @@ -480,7 +480,6 @@ - @@ -535,7 +534,6 @@ - diff --git a/trunk/dist/game/data/stats/skills/01400-01499.xml b/trunk/dist/game/data/stats/skills/01400-01499.xml index 5474f8b55b..d9f4c6b92f 100644 --- a/trunk/dist/game/data/stats/skills/01400-01499.xml +++ b/trunk/dist/game/data/stats/skills/01400-01499.xml @@ -449,9 +449,7 @@ - - - + @@ -716,7 +714,16 @@ - + + + + + + + + + + @@ -945,7 +952,16 @@ - + + + + + + + + + + @@ -3448,7 +3464,13 @@ - + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/01500-01599.xml b/trunk/dist/game/data/stats/skills/01500-01599.xml index 7cde6efb8b..28c8347cfb 100644 --- a/trunk/dist/game/data/stats/skills/01500-01599.xml +++ b/trunk/dist/game/data/stats/skills/01500-01599.xml @@ -175,7 +175,13 @@ - + + + + + + + @@ -1336,7 +1342,18 @@ - + + + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/02200-02299.xml b/trunk/dist/game/data/stats/skills/02200-02299.xml index 97d39b46e8..cb71d69796 100644 --- a/trunk/dist/game/data/stats/skills/02200-02299.xml +++ b/trunk/dist/game/data/stats/skills/02200-02299.xml @@ -889,7 +889,18 @@ - + + + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/02300-02399.xml b/trunk/dist/game/data/stats/skills/02300-02399.xml index 1a6b3b3d00..215200461f 100644 --- a/trunk/dist/game/data/stats/skills/02300-02399.xml +++ b/trunk/dist/game/data/stats/skills/02300-02399.xml @@ -1902,7 +1902,18 @@ - + + + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/02500-02599.xml b/trunk/dist/game/data/stats/skills/02500-02599.xml index ff259b3a00..5cc693277f 100644 --- a/trunk/dist/game/data/stats/skills/02500-02599.xml +++ b/trunk/dist/game/data/stats/skills/02500-02599.xml @@ -1586,7 +1586,16 @@ - + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/02900-02999.xml b/trunk/dist/game/data/stats/skills/02900-02999.xml index a1f428cd94..1bb649d13d 100644 --- a/trunk/dist/game/data/stats/skills/02900-02999.xml +++ b/trunk/dist/game/data/stats/skills/02900-02999.xml @@ -37,7 +37,16 @@ - + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/03000-03099.xml b/trunk/dist/game/data/stats/skills/03000-03099.xml index 51081d50bc..b5c8e8676f 100644 --- a/trunk/dist/game/data/stats/skills/03000-03099.xml +++ b/trunk/dist/game/data/stats/skills/03000-03099.xml @@ -1626,7 +1626,18 @@ - + + + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/03100-03199.xml b/trunk/dist/game/data/stats/skills/03100-03199.xml index 6a62aa45d8..114c1ffffc 100644 --- a/trunk/dist/game/data/stats/skills/03100-03199.xml +++ b/trunk/dist/game/data/stats/skills/03100-03199.xml @@ -87,7 +87,18 @@ - + + + + + + + + + + + + @@ -474,7 +485,18 @@ - + + + + + + + + + + + + @@ -1529,7 +1551,12 @@ - + + + + + + @@ -2544,7 +2571,18 @@ - + + + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/04100-04199.xml b/trunk/dist/game/data/stats/skills/04100-04199.xml index 7011380062..f76a1aa71d 100644 --- a/trunk/dist/game/data/stats/skills/04100-04199.xml +++ b/trunk/dist/game/data/stats/skills/04100-04199.xml @@ -327,7 +327,16 @@ - + + + + + + + + + + @@ -573,9 +582,7 @@ - - - + diff --git a/trunk/dist/game/data/stats/skills/04300-04399.xml b/trunk/dist/game/data/stats/skills/04300-04399.xml index 37dd77e3f6..f87afdd380 100644 --- a/trunk/dist/game/data/stats/skills/04300-04399.xml +++ b/trunk/dist/game/data/stats/skills/04300-04399.xml @@ -195,7 +195,6 @@ - @@ -1531,7 +1530,18 @@ - + + + + + + + + + + + + @@ -1632,16 +1642,13 @@ - - - - - + + diff --git a/trunk/dist/game/data/stats/skills/04500-04599.xml b/trunk/dist/game/data/stats/skills/04500-04599.xml index 3a996f0d4c..cf12b0958c 100644 --- a/trunk/dist/game/data/stats/skills/04500-04599.xml +++ b/trunk/dist/game/data/stats/skills/04500-04599.xml @@ -120,7 +120,18 @@ - + + + + + + + + + + + + @@ -1325,7 +1336,18 @@ - + + + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/04600-04699.xml b/trunk/dist/game/data/stats/skills/04600-04699.xml index 7c8348e348..b7edbc835e 100644 --- a/trunk/dist/game/data/stats/skills/04600-04699.xml +++ b/trunk/dist/game/data/stats/skills/04600-04699.xml @@ -459,7 +459,18 @@ - + + + + + + + + + + + + @@ -1950,8 +1961,8 @@ - + diff --git a/trunk/dist/game/data/stats/skills/05100-05199.xml b/trunk/dist/game/data/stats/skills/05100-05199.xml index e8048f7c45..3dd8a04fe8 100644 --- a/trunk/dist/game/data/stats/skills/05100-05199.xml +++ b/trunk/dist/game/data/stats/skills/05100-05199.xml @@ -1545,7 +1545,18 @@ - + + + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/05200-05299.xml b/trunk/dist/game/data/stats/skills/05200-05299.xml index 1a1af29f83..d13816fe0f 100644 --- a/trunk/dist/game/data/stats/skills/05200-05299.xml +++ b/trunk/dist/game/data/stats/skills/05200-05299.xml @@ -525,7 +525,16 @@ - + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/05500-05599.xml b/trunk/dist/game/data/stats/skills/05500-05599.xml index 92945fa36b..20899ef2cb 100644 --- a/trunk/dist/game/data/stats/skills/05500-05599.xml +++ b/trunk/dist/game/data/stats/skills/05500-05599.xml @@ -449,8 +449,7 @@ - - + @@ -1447,7 +1446,13 @@ - + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/05700-05799.xml b/trunk/dist/game/data/stats/skills/05700-05799.xml index e363195f40..3c6f6cea96 100644 --- a/trunk/dist/game/data/stats/skills/05700-05799.xml +++ b/trunk/dist/game/data/stats/skills/05700-05799.xml @@ -806,7 +806,13 @@ - + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/05900-05999.xml b/trunk/dist/game/data/stats/skills/05900-05999.xml index ca8a229eb4..72aa8be95a 100644 --- a/trunk/dist/game/data/stats/skills/05900-05999.xml +++ b/trunk/dist/game/data/stats/skills/05900-05999.xml @@ -567,7 +567,16 @@ - + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/06000-06099.xml b/trunk/dist/game/data/stats/skills/06000-06099.xml index 08a6f63ccb..ea9baa5483 100644 --- a/trunk/dist/game/data/stats/skills/06000-06099.xml +++ b/trunk/dist/game/data/stats/skills/06000-06099.xml @@ -294,9 +294,18 @@ - - + + + + + + + + + + + @@ -670,7 +679,6 @@ - diff --git a/trunk/dist/game/data/stats/skills/06400-06499.xml b/trunk/dist/game/data/stats/skills/06400-06499.xml index 56c26e4cc9..694015cca3 100644 --- a/trunk/dist/game/data/stats/skills/06400-06499.xml +++ b/trunk/dist/game/data/stats/skills/06400-06499.xml @@ -166,7 +166,18 @@ - + + + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/06700-06799.xml b/trunk/dist/game/data/stats/skills/06700-06799.xml index b0bca2f985..2b1bffa2a6 100644 --- a/trunk/dist/game/data/stats/skills/06700-06799.xml +++ b/trunk/dist/game/data/stats/skills/06700-06799.xml @@ -1052,7 +1052,18 @@ - + + + + + + + + + + + + @@ -1248,7 +1259,18 @@ - + + + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/06800-06899.xml b/trunk/dist/game/data/stats/skills/06800-06899.xml index 8823cf3db0..0aa17c4261 100644 --- a/trunk/dist/game/data/stats/skills/06800-06899.xml +++ b/trunk/dist/game/data/stats/skills/06800-06899.xml @@ -31,7 +31,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -73,7 +73,7 @@ - + @@ -94,7 +94,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -136,7 +136,7 @@ - + @@ -157,7 +157,7 @@ - + @@ -178,7 +178,7 @@ - + @@ -1313,7 +1313,18 @@ - + + + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/10000-10099.xml b/trunk/dist/game/data/stats/skills/10000-10099.xml index cb6dc2d4ab..43795f2b98 100644 --- a/trunk/dist/game/data/stats/skills/10000-10099.xml +++ b/trunk/dist/game/data/stats/skills/10000-10099.xml @@ -1931,8 +1931,8 @@ + - diff --git a/trunk/dist/game/data/stats/skills/10200-10299.xml b/trunk/dist/game/data/stats/skills/10200-10299.xml index 5ed4948f67..63da4fa093 100644 --- a/trunk/dist/game/data/stats/skills/10200-10299.xml +++ b/trunk/dist/game/data/stats/skills/10200-10299.xml @@ -1593,7 +1593,17 @@ - + + + + + + + + + + + @@ -1601,7 +1611,17 @@ - + + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/11000-11099.xml b/trunk/dist/game/data/stats/skills/11000-11099.xml index 3a58c658a7..a261681cda 100644 --- a/trunk/dist/game/data/stats/skills/11000-11099.xml +++ b/trunk/dist/game/data/stats/skills/11000-11099.xml @@ -2416,7 +2416,16 @@ - + + + + + + + + + + @@ -2428,7 +2437,16 @@ - + + + + + + + + + + @@ -2440,7 +2458,16 @@ - + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/11500-11599.xml b/trunk/dist/game/data/stats/skills/11500-11599.xml index 89b676ec29..fb3c85c8c0 100644 --- a/trunk/dist/game/data/stats/skills/11500-11599.xml +++ b/trunk/dist/game/data/stats/skills/11500-11599.xml @@ -1403,19 +1403,17 @@ - - - + + - + - @@ -1555,7 +1553,18 @@ - + + + + + + + + + + + + @@ -2116,7 +2125,16 @@ - + + + + + + + + + + @@ -2126,7 +2144,16 @@ - + + + + + + + + + + @@ -2140,7 +2167,16 @@ - + + + + + + + + + + @@ -2150,8 +2186,17 @@ - - + + + + + + + + + + + @@ -2162,7 +2207,16 @@ - + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/11700-11799.xml b/trunk/dist/game/data/stats/skills/11700-11799.xml index cdf93cb05d..b24c503c19 100644 --- a/trunk/dist/game/data/stats/skills/11700-11799.xml +++ b/trunk/dist/game/data/stats/skills/11700-11799.xml @@ -414,17 +414,13 @@ - - - + - - - + @@ -453,7 +449,18 @@ - + + + + + + + + + + + + @@ -462,7 +469,18 @@ - + + + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/21000-21099.xml b/trunk/dist/game/data/stats/skills/21000-21099.xml index 6339edf453..59dd738016 100644 --- a/trunk/dist/game/data/stats/skills/21000-21099.xml +++ b/trunk/dist/game/data/stats/skills/21000-21099.xml @@ -1522,7 +1522,16 @@ - + + + + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/21200-21299.xml b/trunk/dist/game/data/stats/skills/21200-21299.xml index 6a7ed05d80..3c8bcbef6a 100644 --- a/trunk/dist/game/data/stats/skills/21200-21299.xml +++ b/trunk/dist/game/data/stats/skills/21200-21299.xml @@ -459,7 +459,13 @@ - + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/23100-23199.xml b/trunk/dist/game/data/stats/skills/23100-23199.xml index 2680db94f9..d6c485fb9b 100644 --- a/trunk/dist/game/data/stats/skills/23100-23199.xml +++ b/trunk/dist/game/data/stats/skills/23100-23199.xml @@ -835,8 +835,14 @@ + + + + + - + + @@ -957,7 +963,13 @@ - + + + + + + + diff --git a/trunk/dist/game/data/stats/skills/26100-26199.xml b/trunk/dist/game/data/stats/skills/26100-26199.xml index b30ddcfeaa..5a5e681a51 100644 --- a/trunk/dist/game/data/stats/skills/26100-26199.xml +++ b/trunk/dist/game/data/stats/skills/26100-26199.xml @@ -309,7 +309,16 @@ - + + + + + + + + + + @@ -383,9 +392,7 @@ - - - + diff --git a/trunk/dist/game/data/xsd/instance.xsd b/trunk/dist/game/data/xsd/instance.xsd index 9cf8da5e27..cbab3c94f4 100644 --- a/trunk/dist/game/data/xsd/instance.xsd +++ b/trunk/dist/game/data/xsd/instance.xsd @@ -30,11 +30,32 @@ - + - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -64,9 +85,9 @@ - - - + + + @@ -84,9 +105,9 @@ - - - + + + @@ -130,6 +151,7 @@ + @@ -151,4 +173,4 @@ - \ No newline at end of file + diff --git a/trunk/dist/game/data/xsd/skills.xsd b/trunk/dist/game/data/xsd/skills.xsd index 789865e503..2466fd9268 100644 --- a/trunk/dist/game/data/xsd/skills.xsd +++ b/trunk/dist/game/data/xsd/skills.xsd @@ -246,6 +246,14 @@ + + + + + + + + @@ -471,7 +479,6 @@ - @@ -502,6 +509,7 @@ + @@ -534,7 +542,189 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trunk/java/com/l2jserver/gameserver/ai/L2AttackableAI.java b/trunk/java/com/l2jserver/gameserver/ai/L2AttackableAI.java index cec47ce106..5e119b0370 100644 --- a/trunk/java/com/l2jserver/gameserver/ai/L2AttackableAI.java +++ b/trunk/java/com/l2jserver/gameserver/ai/L2AttackableAI.java @@ -43,7 +43,6 @@ import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.L2Playable; import com.l2jserver.gameserver.model.actor.L2Summon; -import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance; import com.l2jserver.gameserver.model.actor.instance.L2FriendlyMobInstance; import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance; import com.l2jserver.gameserver.model.actor.instance.L2GuardInstance; @@ -180,24 +179,24 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable if (target.isInvul()) { // However EffectInvincible requires to check GMs specially - if ((target instanceof L2PcInstance) && target.isGM()) + if (target.isPlayer() && target.isGM()) { return false; } - if ((target instanceof L2Summon) && ((L2Summon) target).getOwner().isGM()) + if (target.isSummon() && ((L2Summon) target).getOwner().isGM()) { return false; } } // Check if the target isn't a Folk or a Door - if (target instanceof L2DoorInstance) + if (target.isDoor()) { return false; } // Check if the target isn't dead, is in the Aggro range and is at the same height - if (target.isAlikeDead() || ((target instanceof L2Playable) && !me.isInsideRadius(target, me.getAggroRange(), true, false))) + if (target.isAlikeDead() || ((target.isPlayable()) && !me.isInsideRadius(target, me.getAggroRange(), true, false))) { return false; } diff --git a/trunk/java/com/l2jserver/gameserver/ai/L2ControllableMobAI.java b/trunk/java/com/l2jserver/gameserver/ai/L2ControllableMobAI.java index d33a5137b8..d3b3355b50 100644 --- a/trunk/java/com/l2jserver/gameserver/ai/L2ControllableMobAI.java +++ b/trunk/java/com/l2jserver/gameserver/ai/L2ControllableMobAI.java @@ -403,7 +403,7 @@ public final class L2ControllableMobAI extends L2AttackableAI } // TODO(Zoey76)[#112]: This check must change if summon fall in L2Npc hierarchy. - if (target instanceof L2Npc) + if (target.isNpc()) { return false; } diff --git a/trunk/java/com/l2jserver/gameserver/ai/L2FortSiegeGuardAI.java b/trunk/java/com/l2jserver/gameserver/ai/L2FortSiegeGuardAI.java index 19a894a254..bc05b75016 100644 --- a/trunk/java/com/l2jserver/gameserver/ai/L2FortSiegeGuardAI.java +++ b/trunk/java/com/l2jserver/gameserver/ai/L2FortSiegeGuardAI.java @@ -147,11 +147,11 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable if ((target != null) && target.isInvul()) { // However EffectInvincible requires to check GMs specially - if ((target instanceof L2PcInstance) && target.isGM()) + if (target.isPlayer() && target.isGM()) { return false; } - if ((target instanceof L2Summon) && ((L2Summon) target).getOwner().isGM()) + if (target.isSummon() && ((L2Summon) target).getOwner().isGM()) { return false; } diff --git a/trunk/java/com/l2jserver/gameserver/ai/L2PlayerAI.java b/trunk/java/com/l2jserver/gameserver/ai/L2PlayerAI.java index 5f3e8074a4..376bfcf6f5 100644 --- a/trunk/java/com/l2jserver/gameserver/ai/L2PlayerAI.java +++ b/trunk/java/com/l2jserver/gameserver/ai/L2PlayerAI.java @@ -26,6 +26,7 @@ import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import com.l2jserver.gameserver.enums.DuelState; import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Character; @@ -33,6 +34,8 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2StaticObjectInstance; import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.model.skills.targets.L2TargetType; +import com.l2jserver.gameserver.network.SystemMessageId; +import com.l2jserver.gameserver.network.serverpackets.SystemMessage; public class L2PlayerAI extends L2PlayableAI { @@ -190,7 +193,12 @@ public class L2PlayerAI extends L2PlayableAI clientActionFailed(); return; } - + if (_actor.getActingPlayer().getDuelState() == DuelState.DEAD) + { + clientActionFailed(); + _actor.getActingPlayer().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_MOVE_WHILE_FROZEN_PLEASE_WAIT)); + return; + } if (_actor.isAllSkillsDisabled() || _actor.isCastingNow() || _actor.isAttackingNow()) { clientActionFailed(); diff --git a/trunk/java/com/l2jserver/gameserver/ai/L2SiegeGuardAI.java b/trunk/java/com/l2jserver/gameserver/ai/L2SiegeGuardAI.java index d10b56993e..9775538a86 100644 --- a/trunk/java/com/l2jserver/gameserver/ai/L2SiegeGuardAI.java +++ b/trunk/java/com/l2jserver/gameserver/ai/L2SiegeGuardAI.java @@ -136,11 +136,11 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable if (target.isInvul()) { // However EffectInvincible requires to check GMs specially - if ((target instanceof L2PcInstance) && target.isGM()) + if (target.isPlayer() && target.isGM()) { return false; } - if ((target instanceof L2Summon) && ((L2Summon) target).getOwner().isGM()) + if (target.isSummon() && ((L2Summon) target).getOwner().isGM()) { return false; } diff --git a/trunk/java/com/l2jserver/gameserver/data/xml/impl/SkillTreesData.java b/trunk/java/com/l2jserver/gameserver/data/xml/impl/SkillTreesData.java index f77d37a290..e405e623b1 100644 --- a/trunk/java/com/l2jserver/gameserver/data/xml/impl/SkillTreesData.java +++ b/trunk/java/com/l2jserver/gameserver/data/xml/impl/SkillTreesData.java @@ -1583,7 +1583,7 @@ public final class SkillTreesData implements IXmlReader */ public boolean isClanSkill(int skillId, int skillLevel) { - final int hashCode = SkillData.getSkillHashCode(skillId, skillId); + final int hashCode = SkillData.getSkillHashCode(skillId, skillLevel); return _pledgeSkillTree.containsKey(hashCode) || _subPledgeSkillTree.containsKey(hashCode); } diff --git a/trunk/java/com/l2jserver/gameserver/enums/DuelResult.java b/trunk/java/com/l2jserver/gameserver/enums/DuelResult.java index 6bf8d64d04..226664d209 100644 --- a/trunk/java/com/l2jserver/gameserver/enums/DuelResult.java +++ b/trunk/java/com/l2jserver/gameserver/enums/DuelResult.java @@ -18,13 +18,16 @@ */ package com.l2jserver.gameserver.enums; +/** + * @author Zealar + */ public enum DuelResult { - Continue, - Team1Win, - Team2Win, - Team1Surrender, - Team2Surrender, - Canceled, - Timeout + CONTINUE, + TEAM_1_WIN, + TEAM_2_WIN, + TEAM_1_SURRENDER, + TEAM_2_SURRENDER, + CANCELED, + TIMEOUT } diff --git a/trunk/java/com/l2jserver/gameserver/enums/DuelState.java b/trunk/java/com/l2jserver/gameserver/enums/DuelState.java new file mode 100644 index 0000000000..990614311d --- /dev/null +++ b/trunk/java/com/l2jserver/gameserver/enums/DuelState.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2004-2015 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server 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. + * + * L2J Server 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 . + */ +package com.l2jserver.gameserver.enums; + +/** + * @author Zealar + */ +public enum DuelState +{ + NO_DUEL, + DUELLING, + DEAD, + WINNER, + INTERRUPTED +} diff --git a/trunk/java/com/l2jserver/gameserver/enums/StartPosType.java b/trunk/java/com/l2jserver/gameserver/enums/StartPosType.java new file mode 100644 index 0000000000..833113173f --- /dev/null +++ b/trunk/java/com/l2jserver/gameserver/enums/StartPosType.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2004-2015 L2J Server + * + * This file is part of L2J Server. + * + * L2J Server 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. + * + * L2J Server 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 . + */ +package com.l2jserver.gameserver.enums; + +/** + * @author Zealar + */ +public enum StartPosType +{ + FIXED, + RANDOM +} diff --git a/trunk/java/com/l2jserver/gameserver/instancemanager/DuelManager.java b/trunk/java/com/l2jserver/gameserver/instancemanager/DuelManager.java index 6bc2cb8659..f528ab246e 100644 --- a/trunk/java/com/l2jserver/gameserver/instancemanager/DuelManager.java +++ b/trunk/java/com/l2jserver/gameserver/instancemanager/DuelManager.java @@ -18,21 +18,21 @@ */ package com.l2jserver.gameserver.instancemanager; -import java.util.Arrays; -import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; +import com.l2jserver.gameserver.enums.PrivateStoreType; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.entity.Duel; import com.l2jserver.gameserver.model.skills.Skill; +import com.l2jserver.gameserver.model.zone.ZoneId; +import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket; -import com.l2jserver.util.Rnd; +import com.l2jserver.gameserver.network.serverpackets.SystemMessage; public final class DuelManager { - private static final List ARENAS = Arrays.asList("OlympiadGrassyArena.xml", "OlympiadHerossVestigesArena.xml", "OlympiadOrbisArena.xml", "OlympiadThreeBridgesArena.xml"); private final Map _duels = new ConcurrentHashMap<>(); private final AtomicInteger _currentDuelId = new AtomicInteger(); @@ -46,7 +46,7 @@ public final class DuelManager return _duels.get(duelId); } - public void addDuel(L2PcInstance playerA, L2PcInstance playerB, int partyDuel) + public void addDuel(L2PcInstance playerA, L2PcInstance playerB, boolean partyDuel) { if ((playerA == null) || (playerB == null)) { @@ -55,7 +55,7 @@ public final class DuelManager // return if a player has PvPFlag String engagedInPvP = "The duel was canceled because a duelist engaged in PvP combat."; - if (partyDuel == 1) + if (partyDuel) { boolean playerInPvP = false; for (L2PcInstance temp : playerA.getParty().getMembers()) @@ -154,23 +154,6 @@ public final class DuelManager } } - /** - * Removes player from duel. - * @param player - the removed player - */ - public void onRemoveFromParty(L2PcInstance player) - { - if ((player == null) || !player.isInDuel()) - { - return; - } - final Duel duel = getDuel(player.getDuelId()); - if (duel != null) - { - duel.onRemoveFromParty(player); - } - } - /** * Broadcasts a packet to the team opposing the given player. * @param player @@ -183,43 +166,81 @@ public final class DuelManager return; } final Duel duel = getDuel(player.getDuelId()); + if (duel == null) { return; } - if ((duel.getPlayerA() == null) || (duel.getPlayerB() == null)) - { - return; - } - - if (duel.getPlayerA() == player) + if (duel.getTeamA().contains(player)) { duel.broadcastToTeam2(packet); } - else if (duel.getPlayerB() == player) + else { duel.broadcastToTeam1(packet); } - else if (duel.isPartyDuel()) - { - if ((duel.getPlayerA().getParty() != null) && duel.getPlayerA().getParty().getMembers().contains(player)) - { - duel.broadcastToTeam2(packet); - } - else if ((duel.getPlayerB().getParty() != null) && duel.getPlayerB().getParty().getMembers().contains(player)) - { - duel.broadcastToTeam1(packet); - } - } } /** - * Gets new a random Olympiad Stadium instance name. - * @return an instance name + * Checks if this player might join / start a duel.
+ * @param player + * @param target + * @param partyDuel + * @return true if the player might join/start a duel. */ - public String getDuelArena() + public static boolean canDuel(L2PcInstance player, L2PcInstance target, boolean partyDuel) { - return ARENAS.get(Rnd.get(ARENAS.size())); + SystemMessageId reason = null; + if (target.isInCombat() || target.isJailed()) + { + reason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_ENGAGED_IN_BATTLE; + } + else if (target.isTransformed()) + { + reason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_POLYMORPHED; + } + else if (target.isDead() || target.isAlikeDead() || ((target.getCurrentHp() < (target.getMaxHp() / 2)) || (target.getCurrentMp() < (target.getMaxMp() / 2)))) + { + reason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_S_HP_OR_MP_IS_BELOW_50; + } + else if (target.isInDuel()) + { + reason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_ALREADY_ENGAGED_IN_A_DUEL; + } + else if (target.isInOlympiadMode()) + { + reason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_PARTICIPATING_IN_THE_OLYMPIAD_OR_THE_CEREMONY_OF_CHAOS; + } + else if (target.isCursedWeaponEquipped()) + { + reason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_IN_A_CHAOTIC_OR_PURPLE_STATE; + } + else if (target.getPrivateStoreType() != PrivateStoreType.NONE) + { + reason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_ENGAGED_IN_A_PRIVATE_STORE_OR_MANUFACTURE; + } + else if (target.isMounted() || target.isInBoat()) + { + reason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_RIDING_A_BOAT_FENRIR_OR_STRIDER; + } + else if (target.isFishing()) + { + reason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING; + } + else if ((!partyDuel && target.isInsideZone(ZoneId.PEACE)) || target.isInsideZone(ZoneId.PVP) || target.isInsideZone(ZoneId.SIEGE)) + { + reason = SystemMessageId.C1_CANNOT_MAKE_A_CHALLENGE_TO_A_DUEL_BECAUSE_C1_IS_CURRENTLY_IN_A_DUEL_PROHIBITED_AREA_PEACEFUL_ZONE_BATTLE_ZONE_NEAR_WATER_RESTART_PROHIBITED_AREA; + } + + if (reason != null) + { + SystemMessage msg = SystemMessage.getSystemMessage(reason); + msg.addString(target.getName()); + player.sendPacket(msg); + return false; + } + + return true; } public static final DuelManager getInstance() diff --git a/trunk/java/com/l2jserver/gameserver/instancemanager/MapRegionManager.java b/trunk/java/com/l2jserver/gameserver/instancemanager/MapRegionManager.java index bf0ac64967..b983bf53ea 100644 --- a/trunk/java/com/l2jserver/gameserver/instancemanager/MapRegionManager.java +++ b/trunk/java/com/l2jserver/gameserver/instancemanager/MapRegionManager.java @@ -412,7 +412,7 @@ public final class MapRegionManager implements IXmlReader Instance inst = InstanceManager.getInstance().getInstance(player.getInstanceId()); if (inst != null) { - loc = inst.getSpawnLoc(); + loc = inst.getExitLoc(); if (loc != null) { return loc; diff --git a/trunk/java/com/l2jserver/gameserver/model/L2Party.java b/trunk/java/com/l2jserver/gameserver/model/L2Party.java index e5ab2ae5d2..d67adafc5b 100644 --- a/trunk/java/com/l2jserver/gameserver/model/L2Party.java +++ b/trunk/java/com/l2jserver/gameserver/model/L2Party.java @@ -36,7 +36,6 @@ import com.l2jserver.gameserver.GameTimeController; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.datatables.ItemTable; import com.l2jserver.gameserver.enums.PartyDistributionType; -import com.l2jserver.gameserver.instancemanager.DuelManager; import com.l2jserver.gameserver.instancemanager.PcCafePointsManager; import com.l2jserver.gameserver.model.actor.L2Attackable; import com.l2jserver.gameserver.model.actor.L2Character; @@ -485,11 +484,6 @@ public class L2Party extends AbstractPlayerGroup getMembers().remove(player); recalculatePartyLevel(); - if (player.isInDuel()) - { - DuelManager.getInstance().onRemoveFromParty(player); - } - try { // Channeling a player! @@ -564,10 +558,6 @@ public class L2Party extends AbstractPlayerGroup if (getLeader() != null) { getLeader().setParty(null); - if (getLeader().isInDuel()) - { - DuelManager.getInstance().onRemoveFromParty(getLeader()); - } } if (_changeDistributionTypeRequestTask != null) { diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/L2Character.java b/trunk/java/com/l2jserver/gameserver/model/actor/L2Character.java index c25661fa62..d237bc36ca 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/L2Character.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/L2Character.java @@ -2973,7 +2973,27 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe @Override public boolean isInvul() { - return _isInvul || _isTeleporting || isAffected(EffectFlag.INVUL); + return _isInvul || _isTeleporting; + } + + public boolean isHpBlocked() + { + return isAffected(EffectFlag.BLOCK_HP); + } + + public boolean isMpBlocked() + { + return isAffected(EffectFlag.BLOCK_MP); + } + + public boolean isBuffBlocked() + { + return isAffected(EffectFlag.BLOCK_BUFF); + } + + public boolean isDebuffBlocked() + { + return isAffected(EffectFlag.BLOCK_DEBUFF); } public void setIsMortal(boolean b) diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2CubicInstance.java b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2CubicInstance.java index a9759dd8a2..f53151d7b2 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2CubicInstance.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2CubicInstance.java @@ -338,8 +338,8 @@ public final class L2CubicInstance implements IIdentifiable // Duel targeting if (_owner.isInDuel()) { - L2PcInstance PlayerA = DuelManager.getInstance().getDuel(_owner.getDuelId()).getPlayerA(); - L2PcInstance PlayerB = DuelManager.getInstance().getDuel(_owner.getDuelId()).getPlayerB(); + L2PcInstance PlayerA = DuelManager.getInstance().getDuel(_owner.getDuelId()).getTeamLeaderA(); + L2PcInstance PlayerB = DuelManager.getInstance().getDuel(_owner.getDuelId()).getTeamLeaderB(); if (DuelManager.getInstance().getDuel(_owner.getDuelId()).isPartyDuel()) { diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java index 6fb1550e62..564bf35197 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java @@ -83,6 +83,7 @@ import com.l2jserver.gameserver.datatables.SkillData; import com.l2jserver.gameserver.enums.CastleSide; import com.l2jserver.gameserver.enums.CategoryType; import com.l2jserver.gameserver.enums.ChatType; +import com.l2jserver.gameserver.enums.DuelState; import com.l2jserver.gameserver.enums.HtmlActionScope; import com.l2jserver.gameserver.enums.IllegalActionPunishmentType; import com.l2jserver.gameserver.enums.InstanceType; @@ -500,10 +501,8 @@ public final class L2PcInstance extends L2Playable private int _olyBuffsCount = 0; /** Duel */ - private boolean _isInDuel = false; - private int _duelState = Duel.DUELSTATE_NODUEL; + private DuelState _duelState = DuelState.NO_DUEL; private int _duelId = 0; - private SystemMessageId _noDuelReason = SystemMessageId.THERE_IS_NO_OPPONENT_TO_RECEIVE_YOUR_CHALLENGE_FOR_A_DUEL; /** Boat and AirShip */ private L2Vehicle _vehicle = null; @@ -4756,6 +4755,14 @@ public final class L2PcInstance extends L2Playable @Override public void doCast(Skill skill) { + if (getCurrentSkill() != null) + { + if (!checkUseMagicConditions(skill, getCurrentSkill().isCtrlPressed(), getCurrentSkill().isShiftPressed())) + { + setIsCastingNow(false); + return; + } + } super.doCast(skill); setRecentFakeDeath(false); } @@ -6721,7 +6728,7 @@ public final class L2PcInstance extends L2Playable @Override public boolean isInvul() { - return super.isInvul() || (_teleportProtectEndTime > GameTimeController.getInstance().getGameTicks()); + return super.isInvul() || _isTeleporting; } /** @@ -8638,8 +8645,17 @@ public final class L2PcInstance extends L2Playable } // is AutoAttackable if both players are in the same duel and the duel is still going on - if (attacker.isPlayable() && (getDuelState() == Duel.DUELSTATE_DUELLING) && (getDuelId() == attacker.getActingPlayer().getDuelId())) + if (attacker.isPlayable() && (getDuelState() == DuelState.DUELLING) && (getDuelId() == attacker.getActingPlayer().getDuelId())) { + Duel duel = DuelManager.getInstance().getDuel(getDuelId()); + if (duel.getTeamA().contains(this) && duel.getTeamA().contains(attacker)) + { + return false; + } + else if (duel.getTeamB().contains(this) && duel.getTeamB().contains(attacker)) + { + return false; + } return true; } @@ -8814,12 +8830,6 @@ public final class L2PcInstance extends L2Playable setQueuedSkill(null, false, false); } - if (!checkUseMagicConditions(skill, forceUse, dontMove)) - { - setIsCastingNow(false); - return false; - } - // Check if the target is correct and Notify the AI with AI_INTENTION_CAST and target L2Object target = null; switch (skill.getTargetType()) @@ -10181,7 +10191,7 @@ public final class L2PcInstance extends L2Playable @Override public boolean isInDuel() { - return _isInDuel; + return _duelState != DuelState.NO_DUEL; } @Override @@ -10190,12 +10200,12 @@ public final class L2PcInstance extends L2Playable return _duelId; } - public void setDuelState(int mode) + public void setDuelState(DuelState mode) { _duelState = mode; } - public int getDuelState() + public DuelState getDuelState() { return _duelState; } @@ -10208,90 +10218,21 @@ public final class L2PcInstance extends L2Playable { if (duelId > 0) { - _isInDuel = true; - _duelState = Duel.DUELSTATE_DUELLING; + _duelState = DuelState.DUELLING; _duelId = duelId; } else { - if (_duelState == Duel.DUELSTATE_DEAD) + if (_duelState == DuelState.DEAD) { enableAllSkills(); getStatus().startHpMpRegeneration(); } - _isInDuel = false; - _duelState = Duel.DUELSTATE_NODUEL; + _duelState = DuelState.NO_DUEL; _duelId = 0; } } - /** - * This returns a SystemMessage stating why the player is not available for duelling. - * @return S1_CANNOT_DUEL... message - */ - public SystemMessage getNoDuelReason() - { - SystemMessage sm = SystemMessage.getSystemMessage(_noDuelReason); - sm.addPcName(this); - _noDuelReason = SystemMessageId.THERE_IS_NO_OPPONENT_TO_RECEIVE_YOUR_CHALLENGE_FOR_A_DUEL; - return sm; - } - - /** - * Checks if this player might join / start a duel.
- * To get the reason use getNoDuelReason() after calling this function. - * @return true if the player might join/start a duel. - */ - public boolean canDuel() - { - if (isInCombat() || isJailed()) - { - _noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_ENGAGED_IN_BATTLE; - return false; - } - if (isDead() || isAlikeDead() || ((getCurrentHp() < (getMaxHp() / 2)) || (getCurrentMp() < (getMaxMp() / 2)))) - { - _noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_S_HP_OR_MP_IS_BELOW_50; - return false; - } - if (isInDuel()) - { - _noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_ALREADY_ENGAGED_IN_A_DUEL; - return false; - } - if (isInOlympiadMode()) - { - _noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_PARTICIPATING_IN_THE_OLYMPIAD_OR_THE_CEREMONY_OF_CHAOS; - return false; - } - if (isCursedWeaponEquipped()) - { - _noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_IN_A_CHAOTIC_OR_PURPLE_STATE; - return false; - } - if (getPrivateStoreType() != PrivateStoreType.NONE) - { - _noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_ENGAGED_IN_A_PRIVATE_STORE_OR_MANUFACTURE; - return false; - } - if (isMounted() || isInBoat()) - { - _noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_RIDING_A_BOAT_FENRIR_OR_STRIDER; - return false; - } - if (isFishing()) - { - _noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING; - return false; - } - if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE)) - { - _noDuelReason = SystemMessageId.C1_CANNOT_MAKE_A_CHALLENGE_TO_A_DUEL_BECAUSE_C1_IS_CURRENTLY_IN_A_DUEL_PROHIBITED_AREA_PEACEFUL_ZONE_BATTLE_ZONE_NEAR_WATER_RESTART_PROHIBITED_AREA; - return false; - } - return true; - } - public boolean isNoble() { return _noble; @@ -11959,7 +11900,7 @@ public final class L2PcInstance extends L2Playable if (inst != null) { inst.removePlayer(getObjectId()); - final Location loc = inst.getSpawnLoc(); + final Location loc = inst.getExitLoc(); if (loc != null) { final int x = loc.getX() + Rnd.get(-30, 30); @@ -12997,7 +12938,7 @@ public final class L2PcInstance extends L2Playable final SystemMessage sm; - if (target.isInvul() && !target.isVulnerableFor(this) && !target.isNpc()) + if ((target.isInvul() || target.isHpBlocked()) && !target.isVulnerableFor(this) && !target.isNpc()) { sm = SystemMessage.getSystemMessage(SystemMessageId.THE_ATTACK_HAS_BEEN_BLOCKED); } diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2ServitorInstance.java b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2ServitorInstance.java index 3f472aabb7..48be784511 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2ServitorInstance.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2ServitorInstance.java @@ -184,40 +184,6 @@ public class L2ServitorInstance extends L2Summon implements Runnable { } - /** - * Servitors' skills automatically change their level based on the servitor's level.
- * Until level 70, the servitor gets 1 lv of skill per 10 levels.
- * After that, it is 1 skill level per 5 servitor levels.
- * If the resulting skill level doesn't exist use the max that does exist! - */ - @Override - public void doCast(Skill skill) - { - final int petLevel = getLevel(); - int skillLevel = petLevel / 10; - if (petLevel >= 70) - { - skillLevel += (petLevel - 65) / 10; - } - - // Adjust the level for servitors less than level 1. - if (skillLevel < 1) - { - skillLevel = 1; - } - - final Skill skillToCast = SkillData.getInstance().getSkill(skill.getId(), skillLevel); - - if (skillToCast != null) - { - super.doCast(skillToCast); - } - else - { - super.doCast(skill); - } - } - @Override public void setRestoreSummon(boolean val) { diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2SiegeFlagInstance.java b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2SiegeFlagInstance.java index 070e862414..53ae5fd0e1 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2SiegeFlagInstance.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2SiegeFlagInstance.java @@ -86,13 +86,13 @@ public class L2SiegeFlagInstance extends L2Npc @Override public boolean canBeAttacked() { - return !isInvul(); + return !(isInvul() || isHpBlocked()); } @Override public boolean isAutoAttackable(L2Character attacker) { - return !isInvul(); + return !(isInvul() || isHpBlocked()); } @Override diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2TrapInstance.java b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2TrapInstance.java index 17f203c926..e51d0b6100 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2TrapInstance.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2TrapInstance.java @@ -338,7 +338,7 @@ public final class L2TrapInstance extends L2Npc OlympiadGameManager.getInstance().notifyCompetitorDamage(getOwner(), damage); } - if (target.isInvul() && !(target instanceof L2NpcInstance)) + if ((target.isInvul() || target.isHpBlocked()) && !target.isNpc()) { _owner.sendPacket(SystemMessageId.THE_ATTACK_HAS_BEEN_BLOCKED); } diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/status/CharStatus.java b/trunk/java/com/l2jserver/gameserver/model/actor/status/CharStatus.java index 6ba3efaafd..1aec65ad3a 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/status/CharStatus.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/status/CharStatus.java @@ -141,7 +141,7 @@ public class CharStatus } // invul handling - if (getActiveChar().isInvul() && !(isDOT || isHPConsumption)) + if ((getActiveChar().isInvul() || getActiveChar().isHpBlocked()) && !(isDOT || isHPConsumption)) { return; } diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/status/NpcStatus.java b/trunk/java/com/l2jserver/gameserver/model/actor/status/NpcStatus.java index 0b692e45dc..7826584c14 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/status/NpcStatus.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/status/NpcStatus.java @@ -18,10 +18,10 @@ */ package com.l2jserver.gameserver.model.actor.status; +import com.l2jserver.gameserver.enums.DuelState; import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.entity.Duel; public class NpcStatus extends CharStatus { @@ -49,7 +49,7 @@ public class NpcStatus extends CharStatus final L2PcInstance attackerPlayer = attacker.getActingPlayer(); if ((attackerPlayer != null) && attackerPlayer.isInDuel()) { - attackerPlayer.setDuelState(Duel.DUELSTATE_INTERRUPTED); + attackerPlayer.setDuelState(DuelState.INTERRUPTED); } // Add attackers to npc's attacker list diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/status/PcStatus.java b/trunk/java/com/l2jserver/gameserver/model/actor/status/PcStatus.java index 5d2bb64801..3da5f2bcf8 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/status/PcStatus.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/status/PcStatus.java @@ -20,6 +20,7 @@ package com.l2jserver.gameserver.model.actor.status; import com.l2jserver.Config; import com.l2jserver.gameserver.ai.CtrlIntention; +import com.l2jserver.gameserver.enums.DuelState; import com.l2jserver.gameserver.enums.PrivateStoreType; import com.l2jserver.gameserver.instancemanager.DuelManager; import com.l2jserver.gameserver.model.actor.L2Character; @@ -27,7 +28,6 @@ import com.l2jserver.gameserver.model.actor.L2Playable; import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.stat.PcStat; -import com.l2jserver.gameserver.model.entity.Duel; import com.l2jserver.gameserver.model.stats.Formulas; import com.l2jserver.gameserver.model.stats.Stats; import com.l2jserver.gameserver.network.SystemMessageId; @@ -83,7 +83,7 @@ public class PcStatus extends PlayableStatus return; } - if (getActiveChar().isInvul() && !getActiveChar().isVulnerableFor(attacker) && !(isDOT || isHPConsumption)) + if ((getActiveChar().isInvul() || getActiveChar().isHpBlocked()) && !getActiveChar().isVulnerableFor(attacker) && !(isDOT || isHPConsumption)) { return; } @@ -129,11 +129,11 @@ public class PcStatus extends PlayableStatus if (getActiveChar().isInDuel()) { - if (getActiveChar().getDuelState() == Duel.DUELSTATE_DEAD) + if (getActiveChar().getDuelState() == DuelState.DEAD) { return; } - else if (getActiveChar().getDuelState() == Duel.DUELSTATE_WINNER) + else if (getActiveChar().getDuelState() == DuelState.WINNER) { return; } @@ -141,7 +141,7 @@ public class PcStatus extends PlayableStatus // cancel duel if player got hit by another player, that is not part of the duel if (attackerPlayer.getDuelId() != getActiveChar().getDuelId()) { - getActiveChar().setDuelState(Duel.DUELSTATE_INTERRUPTED); + getActiveChar().setDuelState(DuelState.INTERRUPTED); } } } @@ -280,7 +280,10 @@ public class PcStatus extends PlayableStatus { attacker.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); attacker.sendPacket(ActionFailed.STATIC_PACKET); + attacker.setTarget(null); + attacker.abortAttack(); } + // let the DuelManager know of his defeat DuelManager.getInstance().onPlayerDefeat(getActiveChar()); value = 1; diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/status/SummonStatus.java b/trunk/java/com/l2jserver/gameserver/model/actor/status/SummonStatus.java index bab59b7f19..b69cba61d5 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/status/SummonStatus.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/status/SummonStatus.java @@ -18,11 +18,11 @@ */ package com.l2jserver.gameserver.model.actor.status; +import com.l2jserver.gameserver.enums.DuelState; import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Playable; import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.entity.Duel; import com.l2jserver.gameserver.model.stats.Stats; import com.l2jserver.gameserver.util.Util; @@ -50,7 +50,7 @@ public class SummonStatus extends PlayableStatus final L2PcInstance attackerPlayer = attacker.getActingPlayer(); if ((attackerPlayer != null) && ((getActiveChar().getOwner() == null) || (getActiveChar().getOwner().getDuelId() != attackerPlayer.getDuelId()))) { - attackerPlayer.setDuelState(Duel.DUELSTATE_INTERRUPTED); + attackerPlayer.setDuelState(DuelState.INTERRUPTED); } final L2PcInstance caster = getActiveChar().getTransferingDamageTo(); diff --git a/trunk/java/com/l2jserver/gameserver/model/effects/EffectFlag.java b/trunk/java/com/l2jserver/gameserver/model/effects/EffectFlag.java index 38ca194c65..501f84b282 100644 --- a/trunk/java/com/l2jserver/gameserver/model/effects/EffectFlag.java +++ b/trunk/java/com/l2jserver/gameserver/model/effects/EffectFlag.java @@ -24,6 +24,10 @@ package com.l2jserver.gameserver.model.effects; public enum EffectFlag { NONE, + BLOCK_BUFF, + BLOCK_DEBUFF, + BLOCK_HP, + BLOCK_MP, RESURRECTION_SPECIAL, NOBLESS_BLESSING, SILENT_MOVE, @@ -39,7 +43,6 @@ public enum EffectFlag SLEEP, STUNNED, BETRAYED, - INVUL, PARALYZED, BLOCK_RESURRECTION, SERVITOR_SHARE; diff --git a/trunk/java/com/l2jserver/gameserver/model/effects/L2EffectType.java b/trunk/java/com/l2jserver/gameserver/model/effects/L2EffectType.java index efa9a3d8c0..43a44ab798 100644 --- a/trunk/java/com/l2jserver/gameserver/model/effects/L2EffectType.java +++ b/trunk/java/com/l2jserver/gameserver/model/effects/L2EffectType.java @@ -25,6 +25,9 @@ package com.l2jserver.gameserver.model.effects; public enum L2EffectType { AGGRESSION, + BLOCK_BUFF, + BLOCK_DAMAGE, + BLOCK_DEBUFF, BUFF, CHARM_OF_LUCK, CHAT_BLOCK, @@ -66,5 +69,5 @@ public enum L2EffectType SUMMON_PET, SUMMON_NPC, TELEPORT, - TELEPORT_TO_TARGET, + TELEPORT_TO_TARGET } \ No newline at end of file diff --git a/trunk/java/com/l2jserver/gameserver/model/entity/Duel.java b/trunk/java/com/l2jserver/gameserver/model/entity/Duel.java index e120a14992..ed0833d9c4 100644 --- a/trunk/java/com/l2jserver/gameserver/model/entity/Duel.java +++ b/trunk/java/com/l2jserver/gameserver/model/entity/Duel.java @@ -18,6 +18,7 @@ */ package com.l2jserver.gameserver.model.entity; +import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.Map; @@ -29,19 +30,16 @@ import java.util.logging.Logger; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.enums.DuelResult; +import com.l2jserver.gameserver.enums.DuelState; import com.l2jserver.gameserver.enums.Team; import com.l2jserver.gameserver.instancemanager.DuelManager; import com.l2jserver.gameserver.instancemanager.InstanceManager; -import com.l2jserver.gameserver.instancemanager.ZoneManager; import com.l2jserver.gameserver.model.Location; -import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance; -import com.l2jserver.gameserver.model.actor.instance.L2OlympiadManagerInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.model.zone.ZoneId; -import com.l2jserver.gameserver.model.zone.type.L2OlympiadStadiumZone; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; import com.l2jserver.gameserver.network.serverpackets.ExDuelEnd; @@ -52,56 +50,72 @@ import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket; import com.l2jserver.gameserver.network.serverpackets.PlaySound; import com.l2jserver.gameserver.network.serverpackets.SocialAction; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; -import com.l2jserver.util.Rnd; +/** + * @author Zealar + */ public class Duel { protected static final Logger _log = Logger.getLogger(Duel.class.getName()); - public static final int DUELSTATE_NODUEL = 0; - public static final int DUELSTATE_DUELLING = 1; - public static final int DUELSTATE_DEAD = 2; - public static final int DUELSTATE_WINNER = 3; - public static final int DUELSTATE_INTERRUPTED = 4; - private static final PlaySound B04_S01 = new PlaySound(1, "B04_S01", 0, 0, 0, 0, 0); private static final int PARTY_DUEL_DURATION = 300; + private static final int PARTY_DUEL_PREPARE_TIME = 30; + private static final int PARTY_DUEL_TELEPORT_BACK_TIME = 10 * 1000; private static final int PLAYER_DUEL_DURATION = 120; + private static final int DUEL_PREPARE_TIME = 5; private final int _duelId; - private L2PcInstance _playerA; - private L2PcInstance _playerB; + private final List _teamA; + private final L2PcInstance _leaderA; + private final List _teamB; + private final L2PcInstance _leaderB; private final boolean _partyDuel; private final Calendar _duelEndTime; private int _surrenderRequest = 0; - private int _countdown = 5; - private boolean _finished = false; - + private int _countdown; private final Map _playerConditions = new ConcurrentHashMap<>(); private int _duelInstanceId; - public Duel(L2PcInstance playerA, L2PcInstance playerB, int partyDuel, int duelId) + public Duel(L2PcInstance playerA, L2PcInstance playerB, boolean partyDuel, int duelId) { _duelId = duelId; - _playerA = playerA; - _playerB = playerB; - _partyDuel = partyDuel == 1 ? true : false; + if (partyDuel) + { + _leaderA = playerA; + _leaderB = playerB; + _teamA = new ArrayList<>(playerA.getParty().getMembers()); + _teamB = new ArrayList<>(playerB.getParty().getMembers()); + } + else + { + _leaderA = playerA; + _leaderB = playerB; + + _teamA = new ArrayList<>(); + _teamB = new ArrayList<>(); + + _teamA.add(playerA); + _teamB.add(playerB); + } + _partyDuel = partyDuel; _duelEndTime = Calendar.getInstance(); _duelEndTime.add(Calendar.SECOND, _partyDuel ? PARTY_DUEL_DURATION : PLAYER_DUEL_DURATION); - setFinished(false); - + savePlayerConditions(); if (_partyDuel) { - // inform players that they will be ported shortly - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.IN_A_MOMENT_YOU_WILL_BE_TRANSPORTED_TO_THE_SITE_WHERE_THE_DUEL_WILL_TAKE_PLACE); - broadcastToTeam1(sm); - broadcastToTeam2(sm); + _countdown = PARTY_DUEL_PREPARE_TIME; + teleportPlayers(); + } + else + { + _countdown = DUEL_PREPARE_TIME; } // Schedule duel start - ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleStartDuelTask(this), 3000); + ThreadPoolManager.getInstance().scheduleGeneral(new DuelPreparationTask(this), _countdown - 3); } public static class PlayerCondition @@ -144,10 +158,15 @@ public class Duel _player.setCurrentMp(_mp); _player.setCurrentCp(_cp); + _player.setIsInDuel(0); + _player.setTeam(Team.NONE); + _player.broadcastUserInfo(); + if (_paDuel) { teleportBack(); } + if (_debuffs != null) // Debuff removal { for (Skill skill : _debuffs) @@ -172,10 +191,7 @@ public class Duel public void teleportBack() { - if (_paDuel) - { - _player.teleToLocation(_x, _y, _z); - } + _player.teleToLocation(_x, _y, _z); } public L2PcInstance getPlayer() @@ -184,11 +200,41 @@ public class Duel } } - public class ScheduleDuelTask implements Runnable + public static class DuelPreparationTask implements Runnable { private final Duel _duel; - public ScheduleDuelTask(Duel duel) + public DuelPreparationTask(Duel duel) + { + _duel = duel; + } + + @Override + public void run() + { + try + { + if (_duel.countdown() > 0) // duel not started yet - continue countdown + { + ThreadPoolManager.getInstance().scheduleGeneral(this, 1000); + } + else + { + _duel.startDuel(); + } + } + catch (Exception e) + { + _log.log(Level.SEVERE, "There has been a problem while runing a duel start task!", e); + } + } + } + + public class DuelClockTask implements Runnable + { + private final Duel _duel; + + public DuelClockTask(Duel duel) { _duel = duel; } @@ -200,296 +246,120 @@ public class Duel { switch (_duel.checkEndDuelCondition()) { - case Canceled: - { - // do not schedule duel end if it was interrupted - setFinished(true); - _duel.endDuel(DuelResult.Canceled); - break; - } - case Continue: + case CONTINUE: { ThreadPoolManager.getInstance().scheduleGeneral(this, 1000); break; } default: { - setFinished(true); - playKneelAnimation(); - ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleEndDuelTask(_duel, _duel.checkEndDuelCondition()), 5000); - InstanceManager.getInstance().destroyInstance(_duel.getDueldInstanceId()); + endDuel(); break; } } } catch (Exception e) { - _log.log(Level.SEVERE, "There has been a problem while runing a duel task!", e); + _log.log(Level.SEVERE, "There has been a problem while runing a duel end task!", e); } } } - public static class ScheduleStartDuelTask implements Runnable - { - private final Duel _duel; - - public ScheduleStartDuelTask(Duel duel) - { - _duel = duel; - } - - @Override - public void run() - { - try - { - // start/continue countdown - int count = _duel.countdown(); - - if (count == 4) - { - // Save player conditions before teleporting players - _duel.savePlayerConditions(); - - _duel.teleportPlayers(); - - // give players 20 seconds to complete teleport and get ready (its ought to be 30 on official..) - ThreadPoolManager.getInstance().scheduleGeneral(this, _duel.isPartyDuel() ? 20000 : 1); - } - else if (count > 0) // duel not started yet - continue countdown - { - ThreadPoolManager.getInstance().scheduleGeneral(this, 1000); - } - else - { - _duel.startDuel(); - } - } - catch (Exception e) - { - _log.log(Level.SEVERE, "", e); - } - } - } - - public static class ScheduleEndDuelTask implements Runnable - { - private final Duel _duel; - private final DuelResult _result; - - public ScheduleEndDuelTask(Duel duel, DuelResult result) - { - _duel = duel; - _result = result; - } - - @Override - public void run() - { - try - { - _duel.endDuel(_result); - } - catch (Exception e) - { - _log.log(Level.SEVERE, "", e); - } - } - } - - public int getDueldInstanceId() - { - return _duelInstanceId; - } - - /** - * Stops all players from attacking. Used for duel timeout / interrupt. - */ - private void stopFighting() - { - ActionFailed af = ActionFailed.STATIC_PACKET; - if (_partyDuel) - { - for (L2PcInstance temp : _playerA.getParty().getMembers()) - { - temp.abortCast(); - temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); - temp.setTarget(null); - temp.sendPacket(af); - if (temp.hasSummon()) - { - for (L2Summon summon : temp.getServitors().values()) - { - if (!summon.isDead()) - { - summon.abortCast(); - summon.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); - summon.setTarget(null); - summon.sendPacket(af); - } - } - } - } - for (L2PcInstance temp : _playerB.getParty().getMembers()) - { - temp.abortCast(); - temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); - temp.setTarget(null); - temp.sendPacket(af); - if (temp.hasSummon()) - { - for (L2Summon summon : temp.getServitors().values()) - { - if (!summon.isDead()) - { - summon.abortCast(); - summon.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); - summon.setTarget(null); - summon.sendPacket(af); - } - } - } - } - } - else - { - _playerA.abortCast(); - _playerB.abortCast(); - _playerA.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); - _playerA.setTarget(null); - _playerB.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); - _playerB.setTarget(null); - _playerA.sendPacket(af); - _playerB.sendPacket(af); - if (_playerA.hasSummon()) - { - for (L2Summon summon : _playerA.getServitors().values()) - { - if (!summon.isDead()) - { - summon.abortCast(); - summon.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); - summon.setTarget(null); - summon.sendPacket(af); - } - } - } - if (_playerB.hasSummon()) - { - for (L2Summon summon : _playerB.getServitors().values()) - { - if (!summon.isDead()) - { - summon.abortCast(); - summon.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); - summon.setTarget(null); - summon.sendPacket(af); - } - } - } - } - } - - /** - * Check if a player engaged in pvp combat (only for 1on1 duels) - * @param sendMessage - * @return returns true if a duelist is engaged in Pvp combat - */ - public boolean isDuelistInPvp(boolean sendMessage) - { - if (_partyDuel) - { - // Party duels take place in arenas - should be no other players there - return false; - } - else if ((_playerA.getPvpFlag() != 0) || (_playerB.getPvpFlag() != 0)) - { - if (sendMessage) - { - String engagedInPvP = "The duel was canceled because a duelist engaged in PvP combat."; - _playerA.sendMessage(engagedInPvP); - _playerB.sendMessage(engagedInPvP); - } - return true; - } - return false; - } - /** * Starts the duel */ public void startDuel() { - if ((_playerA == null) || (_playerB == null) || _playerA.isInDuel() || _playerB.isInDuel()) + // Set duel state and team + + // Send duel packets + broadcastToTeam1(ExDuelReady.PARTY_DUEL); + broadcastToTeam2(ExDuelReady.PARTY_DUEL); + broadcastToTeam1(ExDuelStart.PARTY_DUEL); + broadcastToTeam2(ExDuelStart.PARTY_DUEL); + + for (L2PcInstance temp : _teamA) { - _playerConditions.clear(); - DuelManager.getInstance().removeDuel(this); - return; + temp.cancelActiveTrade(); + temp.setIsInDuel(_duelId); + temp.setTeam(Team.BLUE); + temp.broadcastUserInfo(); + broadcastToTeam2(new ExDuelUpdateUserInfo(temp)); + } + for (L2PcInstance temp : _teamB) + { + temp.cancelActiveTrade(); + temp.setIsInDuel(_duelId); + temp.setTeam(Team.RED); + temp.broadcastUserInfo(); + broadcastToTeam1(new ExDuelUpdateUserInfo(temp)); } if (_partyDuel) { - // Set duel state and team - for (L2PcInstance temp : _playerA.getParty().getMembers()) - { - temp.cancelActiveTrade(); - temp.setIsInDuel(_duelId); - temp.setTeam(Team.BLUE); - temp.broadcastUserInfo(); - broadcastToTeam2(new ExDuelUpdateUserInfo(temp)); - } - for (L2PcInstance temp : _playerB.getParty().getMembers()) - { - temp.cancelActiveTrade(); - temp.setIsInDuel(_duelId); - temp.setTeam(Team.RED); - temp.broadcastUserInfo(); - broadcastToTeam1(new ExDuelUpdateUserInfo(temp)); - } - - // Send duel packets - broadcastToTeam1(ExDuelReady.PARTY_DUEL); - broadcastToTeam2(ExDuelReady.PARTY_DUEL); - broadcastToTeam1(ExDuelStart.PARTY_DUEL); - broadcastToTeam2(ExDuelStart.PARTY_DUEL); - - // Open arena doors + // Close doors chickens cannot run from the destiny for (L2DoorInstance door : InstanceManager.getInstance().getInstance(getDueldInstanceId()).getDoors()) { - if ((door != null) && !door.getOpen()) + if ((door != null) && door.getOpen()) { - door.openMe(); + door.closeMe(); } } } - else - { - // Set duel state and team - _playerA.setIsInDuel(_duelId); - _playerA.setTeam(Team.BLUE); - _playerB.setIsInDuel(_duelId); - _playerB.setTeam(Team.RED); - - // Send duel Start packets - // Send duel packets - broadcastToTeam1(ExDuelReady.PLAYER_DUEL); - broadcastToTeam2(ExDuelReady.PLAYER_DUEL); - broadcastToTeam1(ExDuelStart.PLAYER_DUEL); - broadcastToTeam2(ExDuelStart.PLAYER_DUEL); - - broadcastToTeam1(new ExDuelUpdateUserInfo(_playerB)); - broadcastToTeam2(new ExDuelUpdateUserInfo(_playerA)); - - _playerA.broadcastUserInfo(); - _playerB.broadcastUserInfo(); - } // play sound broadcastToTeam1(B04_S01); broadcastToTeam2(B04_S01); // start dueling task - ThreadPoolManager.getInstance().scheduleGeneral(new ScheduleDuelTask(this), 1000); + ThreadPoolManager.getInstance().scheduleGeneral(new DuelClockTask(this), 1000); + } + + /** + * Stops all players from attacking. Used for duel timeout / interrupt. + */ + private void stopFighting() + { + for (L2PcInstance temp : _teamA) + { + temp.abortCast(); + temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + temp.setTarget(null); + temp.sendPacket(ActionFailed.STATIC_PACKET); + if (temp.hasSummon()) + { + for (L2Summon summon : temp.getServitors().values()) + { + if (!summon.isDead()) + { + summon.abortCast(); + summon.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + summon.setTarget(null); + summon.sendPacket(ActionFailed.STATIC_PACKET); + } + } + } + } + for (L2PcInstance temp : _teamB) + { + temp.abortCast(); + temp.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + temp.setTarget(null); + temp.sendPacket(ActionFailed.STATIC_PACKET); + if (temp.hasSummon()) + { + for (L2Summon summon : temp.getServitors().values()) + { + if (!summon.isDead()) + { + summon.abortCast(); + summon.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + summon.setTarget(null); + summon.sendPacket(ActionFailed.STATIC_PACKET); + } + } + } + } } /** @@ -497,64 +367,28 @@ public class Duel */ public void savePlayerConditions() { - if (_partyDuel) + for (L2PcInstance player : _teamA) { - for (L2PcInstance player : _playerA.getParty().getMembers()) - { - _playerConditions.put(player.getObjectId(), new PlayerCondition(player, _partyDuel)); - } - for (L2PcInstance player : _playerB.getParty().getMembers()) - { - _playerConditions.put(player.getObjectId(), new PlayerCondition(player, _partyDuel)); - } + _playerConditions.put(player.getObjectId(), new PlayerCondition(player, _partyDuel)); } - else + for (L2PcInstance player : _teamB) { - _playerConditions.put(_playerA.getObjectId(), new PlayerCondition(_playerA, _partyDuel)); - _playerConditions.put(_playerB.getObjectId(), new PlayerCondition(_playerB, _partyDuel)); + _playerConditions.put(player.getObjectId(), new PlayerCondition(player, _partyDuel)); } } /** * Restore player conditions - * @param abnormalDuelEnd true if the duel was the duel canceled */ - public void restorePlayerConditions(boolean abnormalDuelEnd) + public void restorePlayerConditions() { - // update isInDuel() state for all players - if (_partyDuel) - { - for (L2PcInstance temp : _playerA.getParty().getMembers()) - { - temp.setIsInDuel(0); - temp.setTeam(Team.NONE); - temp.broadcastUserInfo(); - } - for (L2PcInstance temp : _playerB.getParty().getMembers()) - { - temp.setIsInDuel(0); - temp.setTeam(Team.NONE); - temp.broadcastUserInfo(); - } - } - else - { - _playerA.setIsInDuel(0); - _playerA.setTeam(Team.NONE); - _playerA.broadcastUserInfo(); - _playerB.setIsInDuel(0); - _playerB.setTeam(Team.NONE); - _playerB.broadcastUserInfo(); - } - - // if it is an abnormal DuelEnd do not restore hp, mp, cp - if (abnormalDuelEnd) - { - return; - } - // restore player conditions - _playerConditions.values().forEach(c -> c.restoreCondition()); + ThreadPoolManager.getInstance().scheduleGeneral(() -> + { + _playerConditions.values().forEach(c -> c.restoreCondition()); + }, _partyDuel ? PARTY_DUEL_TELEPORT_BACK_TIME : 1000); + + ThreadPoolManager.getInstance().scheduleGeneral(() -> clear(), _partyDuel ? PARTY_DUEL_TELEPORT_BACK_TIME : 1000); } /** @@ -566,6 +400,15 @@ public class Duel return _duelId; } + /** + * Get duel instance id + * @return id + */ + public int getDueldInstanceId() + { + return _duelInstanceId; + } + /** * Returns the remaining time * @return remaining time @@ -576,21 +419,60 @@ public class Duel } /** - * Get the player that requested the duel + * Get the team that requested the duel * @return duel requester */ - public L2PcInstance getPlayerA() + public List getTeamA() { - return _playerA; + return _teamA; } /** - * Get the player that was challenged - * @return challenged player + * Get the team that was challenged + * @return challenged team */ - public L2PcInstance getPlayerB() + public List getTeamB() { - return _playerB; + return _teamB; + } + + /** + * Get the team that requested the duel + * @return duel requester + */ + public L2PcInstance getTeamLeaderA() + { + return _leaderA; + } + + /** + * Get the team that was challenged + * @return challenged team + */ + public L2PcInstance getTeamLeaderB() + { + return _leaderB; + } + + /** + * Get the duel looser + * @return looser + */ + public List getLooser() + { + if ((_leaderA == null) || (_leaderB == null)) + { + return null; + } + if (_leaderA.getDuelState() == DuelState.WINNER) + { + return _teamB; + } + else if (_leaderB.getDuelState() == DuelState.WINNER) + { + return _teamA; + } + return null; } /** @@ -602,18 +484,8 @@ public class Duel return _partyDuel; } - public void setFinished(boolean mode) - { - _finished = mode; - } - - public boolean getFinished() - { - return _finished; - } - /** - * Teleports all players to a free arena. + * Teleports all players to a party duel instance. */ public void teleportPlayers() { @@ -622,37 +494,23 @@ public class Duel return; } - final String instanceName = DuelManager.getInstance().getDuelArena(); - final L2OlympiadStadiumZone zone = ZoneManager.getInstance().getAllZones(L2OlympiadStadiumZone.class) // - .stream().filter(z -> z.getInstanceTemplate().equals(instanceName)).findFirst().orElse(null); + _duelInstanceId = InstanceManager.getInstance().createDynamicInstance("PartyDuel.xml"); - if (zone == null) + Instance instance = InstanceManager.getInstance().getInstance(_duelInstanceId); + + int i = 0; + for (L2PcInstance player : _teamA) { - throw new RuntimeException("Unable to find a party duel arena!"); + Location loc = instance.getEnterLocs().get(i++); + + player.teleToLocation(loc.getX(), loc.getY(), loc.getZ(), 0, _duelInstanceId, 0); } - final List spawns = zone.getSpawns(); - _duelInstanceId = InstanceManager.getInstance().createDynamicInstance(instanceName); - - // Remove Olympiad buffers - for (L2Npc buffer : InstanceManager.getInstance().getInstance(getDueldInstanceId()).getNpcs()) + i = 9; + for (L2PcInstance player : _teamB) { - if ((buffer instanceof L2OlympiadManagerInstance) && buffer.isVisible()) - { - buffer.decayMe(); - } - } - - final Location spawn1 = spawns.get(Rnd.get(spawns.size() / 2)); - for (L2PcInstance temp : _playerA.getParty().getMembers()) - { - temp.teleToLocation(spawn1.getX(), spawn1.getY(), spawn1.getZ(), 0, _duelInstanceId, 0); - } - - final Location spawn2 = spawns.get(Rnd.get(spawns.size() / 2, spawns.size())); - for (L2PcInstance temp : _playerB.getParty().getMembers()) - { - temp.teleToLocation(spawn2.getX(), spawn2.getY(), spawn2.getZ(), 0, _duelInstanceId, 0); + Location loc = instance.getEnterLocs().get(i++); + player.teleToLocation(loc.getX(), loc.getY(), loc.getZ(), 0, _duelInstanceId, 0); } } @@ -662,21 +520,14 @@ public class Duel */ public void broadcastToTeam1(L2GameServerPacket packet) { - if (_playerA == null) + if ((_teamA == null) || _teamA.isEmpty()) { return; } - if (_partyDuel && (_playerA.getParty() != null)) + for (L2PcInstance temp : _teamA) { - for (L2PcInstance temp : _playerA.getParty().getMembers()) - { - temp.sendPacket(packet); - } - } - else - { - _playerA.sendPacket(packet); + temp.sendPacket(packet); } } @@ -686,88 +537,32 @@ public class Duel */ public void broadcastToTeam2(L2GameServerPacket packet) { - if (_playerB == null) + if ((_teamB == null) || _teamB.isEmpty()) { return; } - if (_partyDuel && (_playerB.getParty() != null)) + for (L2PcInstance temp : _teamB) { - for (L2PcInstance temp : _playerB.getParty().getMembers()) - { - temp.sendPacket(packet); - } + temp.sendPacket(packet); } - else - { - _playerB.sendPacket(packet); - } - } - - /** - * Get the duel winner - * @return winner - */ - public L2PcInstance getWinner() - { - if (!getFinished() || (_playerA == null) || (_playerB == null)) - { - return null; - } - if (_playerA.getDuelState() == DUELSTATE_WINNER) - { - return _playerA; - } - if (_playerB.getDuelState() == DUELSTATE_WINNER) - { - return _playerB; - } - return null; - } - - /** - * Get the duel looser - * @return looser - */ - public L2PcInstance getLooser() - { - if (!getFinished() || (_playerA == null) || (_playerB == null)) - { - return null; - } - if (_playerA.getDuelState() == DUELSTATE_WINNER) - { - return _playerB; - } - else if (_playerB.getDuelState() == DUELSTATE_WINNER) - { - return _playerA; - } - return null; } /** * Playback the bow animation for all looser */ - public void playKneelAnimation() + private void playKneelAnimation() { - L2PcInstance looser = getLooser(); + List looser = getLooser(); if (looser == null) { return; } - if (_partyDuel && (looser.getParty() != null)) + for (L2PcInstance temp : looser) { - for (L2PcInstance temp : looser.getParty().getMembers()) - { - temp.broadcastPacket(new SocialAction(temp.getObjectId(), 7)); - } - } - else - { - looser.broadcastPacket(new SocialAction(looser.getObjectId(), 7)); + temp.broadcastPacket(new SocialAction(temp.getObjectId(), 7)); } } @@ -775,20 +570,15 @@ public class Duel * Do the countdown and send message to players if necessary * @return current count */ - public int countdown() + int countdown() { - _countdown--; - - if (_countdown > 3) + if (--_countdown > 3) { return _countdown; } - - // Broadcast countdown to duelists - SystemMessage sm = null; + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_DUEL_WILL_BEGIN_IN_S1_SECOND_S); if (_countdown > 0) { - sm = SystemMessage.getSystemMessage(SystemMessageId.THE_DUEL_WILL_BEGIN_IN_S1_SECOND_S); sm.addInt(_countdown); } else @@ -804,98 +594,78 @@ public class Duel /** * The duel has reached a state in which it can no longer continue - * @param result the duel result. */ - public void endDuel(DuelResult result) + void endDuel() { - if ((_playerA == null) || (_playerB == null)) - { - // clean up - _playerConditions.clear(); - DuelManager.getInstance().removeDuel(this); - return; - } - - // inform players of the result - SystemMessage sm = null; - switch (result) - { - case Team1Win: - case Team2Surrender: - restorePlayerConditions(false); - // send SystemMessage - if (_partyDuel) - { - sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL); - } - else - { - sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); - } - sm.addString(_playerA.getName()); - - broadcastToTeam1(sm); - broadcastToTeam2(sm); - break; - case Team1Surrender: - case Team2Win: - restorePlayerConditions(false); - // send SystemMessage - if (_partyDuel) - { - sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL); - } - else - { - sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); - } - sm.addString(_playerB.getName()); - - broadcastToTeam1(sm); - broadcastToTeam2(sm); - break; - case Canceled: - stopFighting(); - // Don't restore hp, mp, cp - restorePlayerConditions(true); - // TODO: is there no other message for a canceled duel? - // send SystemMessage - sm = SystemMessage.getSystemMessage(SystemMessageId.THE_DUEL_HAS_ENDED_IN_A_TIE); - - broadcastToTeam1(sm); - broadcastToTeam2(sm); - break; - case Timeout: - stopFighting(); - // hp,mp,cp seem to be restored in a timeout too... - restorePlayerConditions(false); - // send SystemMessage - sm = SystemMessage.getSystemMessage(SystemMessageId.THE_DUEL_HAS_ENDED_IN_A_TIE); - - broadcastToTeam1(sm); - broadcastToTeam2(sm); - break; - } - + // Send end duel packet final ExDuelEnd duelEnd = _partyDuel ? ExDuelEnd.PARTY_DUEL : ExDuelEnd.PLAYER_DUEL; broadcastToTeam1(duelEnd); broadcastToTeam2(duelEnd); - - // clean up - _playerConditions.clear(); + playKneelAnimation(); + sendEndMessages(); + restorePlayerConditions(); + } + + /** + * Clear current duel from DuelManager + */ + private void clear() + { + InstanceManager.getInstance().destroyInstance(getDueldInstanceId()); DuelManager.getInstance().removeDuel(this); } + /** + * Send required messages for duel end + */ + private void sendEndMessages() + { + SystemMessage sm = null; + switch (checkEndDuelCondition()) + { + case TEAM_1_WIN: + case TEAM_2_SURRENDER: + if (_partyDuel) + { + sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL); + } + else + { + sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); + } + sm.addString(_leaderA.getName()); + break; + case TEAM_1_SURRENDER: + case TEAM_2_WIN: + if (_partyDuel) + { + sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_HAS_WON_THE_DUEL); + } + else + { + sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_WON_THE_DUEL); + } + break; + case CANCELED: + case TIMEOUT: + stopFighting(); + sm = SystemMessage.getSystemMessage(SystemMessageId.THE_DUEL_HAS_ENDED_IN_A_TIE); + break; + } + broadcastToTeam1(sm); + broadcastToTeam2(sm); + } + /** * Did a situation occur in which the duel has to be ended? * @return DuelResult duel status */ - public DuelResult checkEndDuelCondition() + DuelResult checkEndDuelCondition() { // one of the players might leave during duel - if ((_playerA == null) || (_playerB == null)) + if ((_teamA == null) || (_teamB == null)) { - return DuelResult.Canceled; + return DuelResult.CANCELED; } // got a duel surrender request? @@ -903,58 +673,52 @@ public class Duel { if (_surrenderRequest == 1) { - return DuelResult.Team1Surrender; + return DuelResult.TEAM_1_SURRENDER; } - return DuelResult.Team2Surrender; + return DuelResult.TEAM_2_SURRENDER; } // duel timed out else if (getRemainingTime() <= 0) { - return DuelResult.Timeout; + return DuelResult.TIMEOUT; } // Has a player been declared winner yet? - else if (_playerA.getDuelState() == DUELSTATE_WINNER) + else if (_leaderA.getDuelState() == DuelState.WINNER) { // If there is a Winner already there should be no more fighting going on stopFighting(); - return DuelResult.Team1Win; + return DuelResult.TEAM_1_WIN; } - else if (_playerB.getDuelState() == DUELSTATE_WINNER) + else if (_leaderB.getDuelState() == DuelState.WINNER) { // If there is a Winner already there should be no more fighting going on stopFighting(); - return DuelResult.Team2Win; + return DuelResult.TEAM_2_WIN; } // More end duel conditions for 1on1 duels else if (!_partyDuel) { // Duel was interrupted e.g.: player was attacked by mobs / other players - if ((_playerA.getDuelState() == DUELSTATE_INTERRUPTED) || (_playerB.getDuelState() == DUELSTATE_INTERRUPTED)) + if ((_leaderA.getDuelState() == DuelState.INTERRUPTED) || (_leaderB.getDuelState() == DuelState.INTERRUPTED)) { - return DuelResult.Canceled; + return DuelResult.CANCELED; } // Are the players too far apart? - if (!_playerA.isInsideRadius(_playerB, 1600, false, false)) + if (!_leaderA.isInsideRadius(_leaderB, 2000, false, false)) { - return DuelResult.Canceled; - } - - // Did one of the players engage in PvP combat? - if (isDuelistInPvp(true)) - { - return DuelResult.Canceled; + return DuelResult.CANCELED; } // is one of the players in a Siege, Peace or PvP zone? - if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP)) + if (_leaderA.isInsideZone(ZoneId.PEACE) || _leaderB.isInsideZone(ZoneId.PEACE) || _leaderA.isInsideZone(ZoneId.SIEGE) || _leaderB.isInsideZone(ZoneId.SIEGE) || _leaderA.isInsideZone(ZoneId.PVP) || _leaderB.isInsideZone(ZoneId.PVP)) { - return DuelResult.Canceled; + return DuelResult.CANCELED; } } - return DuelResult.Continue; + return DuelResult.CONTINUE; } /** @@ -964,7 +728,7 @@ public class Duel public void doSurrender(L2PcInstance player) { // already received a surrender request - if (_surrenderRequest != 0) + if ((_surrenderRequest != 0) || _partyDuel) { return; } @@ -972,49 +736,17 @@ public class Duel // stop the fight stopFighting(); - // TODO: Can every party member cancel a party duel? or only the party leaders? - if (_partyDuel) + if (player == _leaderA) { - if (_playerA.getParty().getMembers().contains(player)) - { - _surrenderRequest = 1; - for (L2PcInstance temp : _playerA.getParty().getMembers()) - { - temp.setDuelState(DUELSTATE_DEAD); - } - for (L2PcInstance temp : _playerB.getParty().getMembers()) - { - temp.setDuelState(DUELSTATE_WINNER); - } - } - else if (_playerB.getParty().getMembers().contains(player)) - { - _surrenderRequest = 2; - for (L2PcInstance temp : _playerB.getParty().getMembers()) - { - temp.setDuelState(DUELSTATE_DEAD); - } - for (L2PcInstance temp : _playerA.getParty().getMembers()) - { - temp.setDuelState(DUELSTATE_WINNER); - } - - } + _surrenderRequest = 1; + _leaderA.setDuelState(DuelState.DEAD); + _leaderB.setDuelState(DuelState.WINNER); } - else + else if (player == _leaderB) { - if (player == _playerA) - { - _surrenderRequest = 1; - _playerA.setDuelState(DUELSTATE_DEAD); - _playerB.setDuelState(DUELSTATE_WINNER); - } - else if (player == _playerB) - { - _surrenderRequest = 2; - _playerB.setDuelState(DUELSTATE_DEAD); - _playerA.setDuelState(DUELSTATE_WINNER); - } + _surrenderRequest = 2; + _leaderB.setDuelState(DuelState.DEAD); + _leaderA.setDuelState(DuelState.WINNER); } } @@ -1025,90 +757,65 @@ public class Duel public void onPlayerDefeat(L2PcInstance player) { // Set player as defeated - player.setDuelState(DUELSTATE_DEAD); + player.setDuelState(DuelState.DEAD); + player.setTeam(Team.NONE); if (_partyDuel) { boolean teamdefeated = true; - for (L2PcInstance temp : player.getParty().getMembers()) + + boolean isInTeamA = true; + + if (_teamA.contains(player)) { - if (temp.getDuelState() == DUELSTATE_DUELLING) + for (L2PcInstance temp : _teamA) { - teamdefeated = false; - break; + if (temp.getDuelState() == DuelState.DUELLING) + { + teamdefeated = false; + break; + } + } + } + else if (_teamB.contains(player)) + { + isInTeamA = false; + for (L2PcInstance temp : _teamB) + { + if (temp.getDuelState() == DuelState.DUELLING) + { + teamdefeated = false; + break; + } } } - if (teamdefeated) { - L2PcInstance winner = _playerA; - if (_playerA.getParty().getMembers().contains(player)) + List winners = (isInTeamA ? _teamB : _teamA); + for (L2PcInstance temp : winners) { - winner = _playerB; - } - - for (L2PcInstance temp : winner.getParty().getMembers()) - { - temp.setDuelState(DUELSTATE_WINNER); + temp.setDuelState(DuelState.WINNER); } } } else { - if ((player != _playerA) && (player != _playerB)) + if ((player != _leaderA) && (player != _leaderB)) { - _log.warning("Error in onPlayerDefeat(): player is not part of this 1vs1 duel"); + _log.warning("Error in onPlayerDefeat(): player is not part of this 1vs1 duel!"); } - if (_playerA == player) + if (_leaderA == player) { - _playerB.setDuelState(DUELSTATE_WINNER); + _leaderB.setDuelState(DuelState.WINNER); } else { - _playerA.setDuelState(DUELSTATE_WINNER); + _leaderA.setDuelState(DuelState.WINNER); } } } - /** - * This function is called whenever a player leaves a party - * @param player the player quitting. - */ - public void onRemoveFromParty(L2PcInstance player) - { - // if it isn't a party duel ignore this - if (!_partyDuel) - { - return; - } - - // this player is leaving his party during party duel - // if he's either playerA or playerB cancel the duel and port the players back - if ((player == _playerA) || (player == _playerB)) - { - for (PlayerCondition cond : _playerConditions.values()) - { - cond.teleportBack(); - cond.getPlayer().setIsInDuel(0); - } - - _playerA = null; - _playerB = null; - } - else - // teleport the player back & delete his PlayerCondition record - { - final PlayerCondition cond = _playerConditions.get(player.getObjectId()); - if (cond != null) - { - cond.teleportBack(); - _playerConditions.remove(cond); - } - player.setIsInDuel(0); - } - } - public void onBuff(L2PcInstance player, Skill debuff) { final PlayerCondition cond = _playerConditions.get(player.getObjectId()); diff --git a/trunk/java/com/l2jserver/gameserver/model/entity/Instance.java b/trunk/java/com/l2jserver/gameserver/model/entity/Instance.java index cfe2d9487a..62fe596336 100644 --- a/trunk/java/com/l2jserver/gameserver/model/entity/Instance.java +++ b/trunk/java/com/l2jserver/gameserver/model/entity/Instance.java @@ -82,7 +82,9 @@ public final class Instance private final List _npcs = new CopyOnWriteArrayList<>(); private final Map _doors = new ConcurrentHashMap<>(); private final Map> _manualSpawn = new HashMap<>(); - private Location _spawnLoc = null; + // private StartPosType _enterLocationOrder; TODO implement me + private List _enterLocations = null; + private Location _exitLocation = null; private boolean _allowSummon = true; private long _emptyDestroyTime = -1; private long _lastLeft = -1; @@ -323,21 +325,38 @@ public final class Instance return _timerText; } + /** + * @return the spawn location for this instance to be used when enter in instance + */ + public List getEnterLocs() + { + return _enterLocations; + } + + /** + * Sets the spawn location for this instance to be used when enter in instance + * @param loc + */ + public void addEnterLoc(Location loc) + { + _enterLocations.add(loc); + } + /** * @return the spawn location for this instance to be used when leaving the instance */ - public Location getSpawnLoc() + public Location getExitLoc() { - return _spawnLoc; + return _exitLocation; } /** * Sets the spawn location for this instance to be used when leaving the instance * @param loc */ - public void setSpawnLoc(Location loc) + public void setExitLoc(Location loc) { - _spawnLoc = loc; + _exitLocation = loc; } public void removePlayers() @@ -348,9 +367,9 @@ public final class Instance if ((player != null) && (player.getInstanceId() == getId())) { player.setInstanceId(0); - if (getSpawnLoc() != null) + if (getExitLoc() != null) { - player.teleToLocation(getSpawnLoc(), true); + player.teleToLocation(getExitLoc(), true); } else { @@ -477,257 +496,272 @@ public final class Instance Node first = n.getFirstChild(); for (n = first; n != null; n = n.getNextSibling()) { - if ("activityTime".equalsIgnoreCase(n.getNodeName())) + switch (n.getNodeName().toLowerCase()) { - a = n.getAttributes().getNamedItem("val"); - if (a != null) + case "activitytime": { - _checkTimeUpTask = ThreadPoolManager.getInstance().scheduleGeneral(new CheckTimeUp(Integer.parseInt(a.getNodeValue()) * 60000), 15000); - _instanceEndTime = System.currentTimeMillis() + (Long.parseLong(a.getNodeValue()) * 60000) + 15000; - } - } - // @formatter:off - /* - else if ("timeDelay".equalsIgnoreCase(n.getNodeName())) - { - a = n.getAttributes().getNamedItem("val"); - if (a != null) - { - instance.setTimeDelay(Integer.parseInt(a.getNodeValue())); - } - } - */ - // @formatter:on - else if ("allowSummon".equalsIgnoreCase(n.getNodeName())) - { - a = n.getAttributes().getNamedItem("val"); - if (a != null) - { - setAllowSummon(Boolean.parseBoolean(a.getNodeValue())); - } - } - else if ("emptyDestroyTime".equalsIgnoreCase(n.getNodeName())) - { - a = n.getAttributes().getNamedItem("val"); - if (a != null) - { - _emptyDestroyTime = Long.parseLong(a.getNodeValue()) * 1000; - } - } - else if ("showTimer".equalsIgnoreCase(n.getNodeName())) - { - a = n.getAttributes().getNamedItem("val"); - if (a != null) - { - _showTimer = Boolean.parseBoolean(a.getNodeValue()); - } - a = n.getAttributes().getNamedItem("increase"); - if (a != null) - { - _isTimerIncrease = Boolean.parseBoolean(a.getNodeValue()); - } - a = n.getAttributes().getNamedItem("text"); - if (a != null) - { - _timerText = a.getNodeValue(); - } - } - else if ("PvPInstance".equalsIgnoreCase(n.getNodeName())) - { - a = n.getAttributes().getNamedItem("val"); - if (a != null) - { - setPvPInstance(Boolean.parseBoolean(a.getNodeValue())); - } - } - else if ("doorlist".equalsIgnoreCase(n.getNodeName())) - { - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) - { - int doorId = 0; - if ("door".equalsIgnoreCase(d.getNodeName())) + a = n.getAttributes().getNamedItem("val"); + if (a != null) { - doorId = Integer.parseInt(d.getAttributes().getNamedItem("doorId").getNodeValue()); - StatsSet set = new StatsSet(); - set.add(DoorData.getInstance().getDoorTemplate(doorId)); - for (Node bean = d.getFirstChild(); bean != null; bean = bean.getNextSibling()) - { - if ("set".equalsIgnoreCase(bean.getNodeName())) - { - NamedNodeMap attrs = bean.getAttributes(); - String setname = attrs.getNamedItem("name").getNodeValue(); - String value = attrs.getNamedItem("val").getNodeValue(); - set.set(setname, value); - } - } - addDoor(doorId, set); + _checkTimeUpTask = ThreadPoolManager.getInstance().scheduleGeneral(new CheckTimeUp(Integer.parseInt(a.getNodeValue()) * 60000), 15000); + _instanceEndTime = System.currentTimeMillis() + (Long.parseLong(a.getNodeValue()) * 60000) + 15000; } + break; } - } - else if ("spawnlist".equalsIgnoreCase(n.getNodeName())) - { - for (Node group = n.getFirstChild(); group != null; group = group.getNextSibling()) + case "allowsummon": { - if ("group".equalsIgnoreCase(group.getNodeName())) + a = n.getAttributes().getNamedItem("val"); + if (a != null) { - String spawnGroup = group.getAttributes().getNamedItem("name").getNodeValue(); - List manualSpawn = new ArrayList<>(); - for (Node d = group.getFirstChild(); d != null; d = d.getNextSibling()) + setAllowSummon(Boolean.parseBoolean(a.getNodeValue())); + } + break; + } + case "emptydestroytime": + { + a = n.getAttributes().getNamedItem("val"); + if (a != null) + { + _emptyDestroyTime = Long.parseLong(a.getNodeValue()) * 1000; + } + break; + } + case "showtimer": + { + a = n.getAttributes().getNamedItem("val"); + if (a != null) + { + _showTimer = Boolean.parseBoolean(a.getNodeValue()); + } + a = n.getAttributes().getNamedItem("increase"); + if (a != null) + { + _isTimerIncrease = Boolean.parseBoolean(a.getNodeValue()); + } + a = n.getAttributes().getNamedItem("text"); + if (a != null) + { + _timerText = a.getNodeValue(); + } + break; + } + case "pvpinstance": + { + a = n.getAttributes().getNamedItem("val"); + if (a != null) + { + setPvPInstance(Boolean.parseBoolean(a.getNodeValue())); + } + break; + } + case "doorlist": + { + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) + { + int doorId = 0; + if ("door".equalsIgnoreCase(d.getNodeName())) { - int npcId = 0, x = 0, y = 0, z = 0, heading = 0, respawn = 0, respawnRandom = 0, delay = -1; - Boolean allowRandomWalk = null; - if ("spawn".equalsIgnoreCase(d.getNodeName())) + doorId = Integer.parseInt(d.getAttributes().getNamedItem("doorId").getNodeValue()); + StatsSet set = new StatsSet(); + set.add(DoorData.getInstance().getDoorTemplate(doorId)); + for (Node bean = d.getFirstChild(); bean != null; bean = bean.getNextSibling()) { - - npcId = Integer.parseInt(d.getAttributes().getNamedItem("npcId").getNodeValue()); - x = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue()); - y = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue()); - z = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue()); - heading = Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()); - respawn = Integer.parseInt(d.getAttributes().getNamedItem("respawn").getNodeValue()); - if (d.getAttributes().getNamedItem("onKillDelay") != null) + if ("set".equalsIgnoreCase(bean.getNodeName())) { - delay = Integer.parseInt(d.getAttributes().getNamedItem("onKillDelay").getNodeValue()); + NamedNodeMap attrs = bean.getAttributes(); + String setname = attrs.getNamedItem("name").getNodeValue(); + String value = attrs.getNamedItem("val").getNodeValue(); + set.set(setname, value); } - if (d.getAttributes().getNamedItem("respawnRandom") != null) + } + addDoor(doorId, set); + } + } + break; + } + case "spawnlist": + { + for (Node group = n.getFirstChild(); group != null; group = group.getNextSibling()) + { + if ("group".equalsIgnoreCase(group.getNodeName())) + { + String spawnGroup = group.getAttributes().getNamedItem("name").getNodeValue(); + List manualSpawn = new ArrayList<>(); + for (Node d = group.getFirstChild(); d != null; d = d.getNextSibling()) + { + int npcId = 0, x = 0, y = 0, z = 0, heading = 0, respawn = 0, respawnRandom = 0, delay = -1; + Boolean allowRandomWalk = null; + if ("spawn".equalsIgnoreCase(d.getNodeName())) { - respawnRandom = Integer.parseInt(d.getAttributes().getNamedItem("respawnRandom").getNodeValue()); - } - if (d.getAttributes().getNamedItem("allowRandomWalk") != null) - { - allowRandomWalk = Boolean.valueOf(d.getAttributes().getNamedItem("allowRandomWalk").getNodeValue()); - } - - final L2Spawn spawnDat = new L2Spawn(npcId); - spawnDat.setX(x); - spawnDat.setY(y); - spawnDat.setZ(z); - spawnDat.setAmount(1); - spawnDat.setHeading(heading); - spawnDat.setRespawnDelay(respawn, respawnRandom); - if (respawn == 0) - { - spawnDat.stopRespawn(); - } - else - { - spawnDat.startRespawn(); - } - spawnDat.setInstanceId(getId()); - if (allowRandomWalk == null) - { - spawnDat.setIsNoRndWalk(!_allowRandomWalk); - } - else - { - spawnDat.setIsNoRndWalk(!allowRandomWalk); - } - if (spawnGroup.equals("general")) - { - L2Npc spawned = spawnDat.doSpawn(); - if ((delay >= 0) && (spawned instanceof L2Attackable)) + + npcId = Integer.parseInt(d.getAttributes().getNamedItem("npcId").getNodeValue()); + x = Integer.parseInt(d.getAttributes().getNamedItem("x").getNodeValue()); + y = Integer.parseInt(d.getAttributes().getNamedItem("y").getNodeValue()); + z = Integer.parseInt(d.getAttributes().getNamedItem("z").getNodeValue()); + heading = Integer.parseInt(d.getAttributes().getNamedItem("heading").getNodeValue()); + respawn = Integer.parseInt(d.getAttributes().getNamedItem("respawn").getNodeValue()); + if (d.getAttributes().getNamedItem("onKillDelay") != null) { - ((L2Attackable) spawned).setOnKillDelay(delay); + delay = Integer.parseInt(d.getAttributes().getNamedItem("onKillDelay").getNodeValue()); + } + if (d.getAttributes().getNamedItem("respawnRandom") != null) + { + respawnRandom = Integer.parseInt(d.getAttributes().getNamedItem("respawnRandom").getNodeValue()); + } + if (d.getAttributes().getNamedItem("allowRandomWalk") != null) + { + allowRandomWalk = Boolean.valueOf(d.getAttributes().getNamedItem("allowRandomWalk").getNodeValue()); + } + + final L2Spawn spawnDat = new L2Spawn(npcId); + spawnDat.setX(x); + spawnDat.setY(y); + spawnDat.setZ(z); + spawnDat.setAmount(1); + spawnDat.setHeading(heading); + spawnDat.setRespawnDelay(respawn, respawnRandom); + if (respawn == 0) + { + spawnDat.stopRespawn(); + } + else + { + spawnDat.startRespawn(); + } + spawnDat.setInstanceId(getId()); + if (allowRandomWalk == null) + { + spawnDat.setIsNoRndWalk(!_allowRandomWalk); + } + else + { + spawnDat.setIsNoRndWalk(!allowRandomWalk); + } + if (spawnGroup.equals("general")) + { + L2Npc spawned = spawnDat.doSpawn(); + if ((delay >= 0) && (spawned instanceof L2Attackable)) + { + ((L2Attackable) spawned).setOnKillDelay(delay); + } + } + else + { + manualSpawn.add(spawnDat); } } - else + } + if (!manualSpawn.isEmpty()) + { + _manualSpawn.put(spawnGroup, manualSpawn); + } + } + } + break; + } + case "exitpoint": + { + int x = Integer.parseInt(n.getAttributes().getNamedItem("x").getNodeValue()); + int y = Integer.parseInt(n.getAttributes().getNamedItem("y").getNodeValue()); + int z = Integer.parseInt(n.getAttributes().getNamedItem("z").getNodeValue()); + _exitLocation = new Location(x, y, z); + break; + } + case "spawnpoints": + { + _enterLocations = new ArrayList<>(); + for (Node loc = n.getFirstChild(); loc != null; loc = loc.getNextSibling()) + { + if (loc.getNodeName().equals("Location")) + { + try + { + int x = Integer.parseInt(loc.getAttributes().getNamedItem("x").getNodeValue()); + int y = Integer.parseInt(loc.getAttributes().getNamedItem("y").getNodeValue()); + int z = Integer.parseInt(loc.getAttributes().getNamedItem("z").getNodeValue()); + _enterLocations.add(new Location(x, y, z)); + } + catch (Exception e) + { + _log.log(Level.WARNING, "Error parsing instance xml: " + e.getMessage(), e); + } + } + } + break; + } + case "reenter": + { + a = n.getAttributes().getNamedItem("additionStyle"); + if (a != null) + { + _type = InstanceReenterType.valueOf(a.getNodeValue()); + } + + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) + { + long time = -1; + DayOfWeek day = null; + int hour = -1; + int minute = -1; + + if ("reset".equalsIgnoreCase(d.getNodeName())) + { + a = d.getAttributes().getNamedItem("time"); + if (a != null) + { + time = Long.parseLong(a.getNodeValue()); + + if (time > 0) { - manualSpawn.add(spawnDat); + _resetData.add(new InstanceReenterTimeHolder(time)); + break; } } - } - if (!manualSpawn.isEmpty()) - { - _manualSpawn.put(spawnGroup, manualSpawn); + else if (time == -1) + { + a = d.getAttributes().getNamedItem("day"); + if (a != null) + { + day = DayOfWeek.valueOf(a.getNodeValue().toUpperCase()); + } + + a = d.getAttributes().getNamedItem("hour"); + if (a != null) + { + hour = Integer.parseInt(a.getNodeValue()); + } + + a = d.getAttributes().getNamedItem("minute"); + if (a != null) + { + minute = Integer.parseInt(a.getNodeValue()); + } + _resetData.add(new InstanceReenterTimeHolder(day, hour, minute)); + } } } + break; } - } - else if ("spawnpoint".equalsIgnoreCase(n.getNodeName())) - { - try + case "removebuffs": { - int x = Integer.parseInt(n.getAttributes().getNamedItem("spawnX").getNodeValue()); - int y = Integer.parseInt(n.getAttributes().getNamedItem("spawnY").getNodeValue()); - int z = Integer.parseInt(n.getAttributes().getNamedItem("spawnZ").getNodeValue()); - _spawnLoc = new Location(x, y, z); - } - catch (Exception e) - { - _log.log(Level.WARNING, "Error parsing instance xml: " + e.getMessage(), e); - _spawnLoc = null; - } - } - else if ("reenter".equalsIgnoreCase(n.getNodeName())) - { - a = n.getAttributes().getNamedItem("additionStyle"); - if (a != null) - { - _type = InstanceReenterType.valueOf(a.getNodeValue()); - } - - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) - { - long time = -1; - DayOfWeek day = null; - int hour = -1; - int minute = -1; + a = n.getAttributes().getNamedItem("type"); + if (a != null) + { + _removeBuffType = InstanceRemoveBuffType.valueOf(a.getNodeValue().toUpperCase()); + } - if ("reset".equalsIgnoreCase(d.getNodeName())) + for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) { - a = d.getAttributes().getNamedItem("time"); - if (a != null) + if ("skill".equalsIgnoreCase(d.getNodeName())) { - time = Long.parseLong(a.getNodeValue()); - - if (time > 0) - { - _resetData.add(new InstanceReenterTimeHolder(time)); - break; - } - } - else if (time == -1) - { - a = d.getAttributes().getNamedItem("day"); + a = d.getAttributes().getNamedItem("id"); if (a != null) { - day = DayOfWeek.valueOf(a.getNodeValue().toUpperCase()); + _exceptionList.add(Integer.parseInt(a.getNodeValue())); } - - a = d.getAttributes().getNamedItem("hour"); - if (a != null) - { - hour = Integer.parseInt(a.getNodeValue()); - } - - a = d.getAttributes().getNamedItem("minute"); - if (a != null) - { - minute = Integer.parseInt(a.getNodeValue()); - } - _resetData.add(new InstanceReenterTimeHolder(day, hour, minute)); - } - } - } - } - else if ("removeBuffs".equalsIgnoreCase(n.getNodeName())) - { - a = n.getAttributes().getNamedItem("type"); - if (a != null) - { - _removeBuffType = InstanceRemoveBuffType.valueOf(a.getNodeValue().toUpperCase()); - } - - for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) - { - if ("skill".equalsIgnoreCase(d.getNodeName())) - { - a = d.getAttributes().getNamedItem("id"); - if (a != null) - { - _exceptionList.add(Integer.parseInt(a.getNodeValue())); } } + break; } } } @@ -854,9 +888,9 @@ public final class Instance if (player.isDead() && (player.getInstanceId() == getId())) { player.setInstanceId(0); - if (getSpawnLoc() != null) + if (getExitLoc() != null) { - player.teleToLocation(getSpawnLoc(), true); + player.teleToLocation(getExitLoc(), true); } else { @@ -934,4 +968,4 @@ public final class Instance { return _exceptionList; } -} \ No newline at end of file +} diff --git a/trunk/java/com/l2jserver/gameserver/model/entity/TvTEventTeleporter.java b/trunk/java/com/l2jserver/gameserver/model/entity/TvTEventTeleporter.java index cec75fb21d..67b22ff0a4 100644 --- a/trunk/java/com/l2jserver/gameserver/model/entity/TvTEventTeleporter.java +++ b/trunk/java/com/l2jserver/gameserver/model/entity/TvTEventTeleporter.java @@ -20,6 +20,7 @@ package com.l2jserver.gameserver.model.entity; import com.l2jserver.Config; import com.l2jserver.gameserver.ThreadPoolManager; +import com.l2jserver.gameserver.enums.DuelState; import com.l2jserver.gameserver.enums.Team; import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; @@ -77,14 +78,14 @@ public class TvTEventTeleporter implements Runnable _playerInstance.getServitors().values().forEach(s -> s.unSummon(_playerInstance)); - if ((Config.TVT_EVENT_EFFECTS_REMOVAL == 0) || ((Config.TVT_EVENT_EFFECTS_REMOVAL == 1) && ((_playerInstance.getTeam() == Team.NONE) || (_playerInstance.isInDuel() && (_playerInstance.getDuelState() != Duel.DUELSTATE_INTERRUPTED))))) + if ((Config.TVT_EVENT_EFFECTS_REMOVAL == 0) || ((Config.TVT_EVENT_EFFECTS_REMOVAL == 1) && ((_playerInstance.getTeam() == Team.NONE) || (_playerInstance.isInDuel() && (_playerInstance.getDuelState() != DuelState.INTERRUPTED))))) { _playerInstance.stopAllEffectsExceptThoseThatLastThroughDeath(); } if (_playerInstance.isInDuel()) { - _playerInstance.setDuelState(Duel.DUELSTATE_INTERRUPTED); + _playerInstance.setDuelState(DuelState.INTERRUPTED); } int TvTInstance = TvTEvent.getTvTEventInstance(); diff --git a/trunk/java/com/l2jserver/gameserver/model/skills/Skill.java b/trunk/java/com/l2jserver/gameserver/model/skills/Skill.java index d1a3ee351a..9477c6426c 100644 --- a/trunk/java/com/l2jserver/gameserver/model/skills/Skill.java +++ b/trunk/java/com/l2jserver/gameserver/model/skills/Skill.java @@ -1372,6 +1372,21 @@ public final class Skill implements IIdentifiable return; } + if (isDebuff()) + { + if (effected.isDebuffBlocked()) + { + return; + } + } + else + { + if (effected.isBuffBlocked() && !isBad()) + { + return; + } + } + if (effected.isInvulAgainst(getId(), getLevel())) { effected.sendDebugMessage("Skill " + toString() + " has been ignored (invul against)"); diff --git a/trunk/java/com/l2jserver/gameserver/model/stats/Formulas.java b/trunk/java/com/l2jserver/gameserver/model/stats/Formulas.java index 870e6b2e34..2723387d3d 100644 --- a/trunk/java/com/l2jserver/gameserver/model/stats/Formulas.java +++ b/trunk/java/com/l2jserver/gameserver/model/stats/Formulas.java @@ -1337,12 +1337,9 @@ public final class Formulas double attack = 2 * actor.getMAtk(target, skill) * calcGeneralTraitBonus(actor, target, skill.getTraitType(), false); double d = (attack - defence) / (attack + defence); - if (skill.isDebuff()) + if (skill.isDebuff() && target.isDebuffBlocked()) { - if (target.calcStat(Stats.DEBUFF_IMMUNITY, 0, null, skill) > 0) - { - return false; - } + return false; } d += 0.5 * Rnd.nextGaussian(); @@ -1372,7 +1369,7 @@ public final class Formulas return false; } - if (skill.isDebuff() && (target.calcStat(Stats.DEBUFF_IMMUNITY, 0, attacker, skill) > 0)) + if (skill.isDebuff() && target.isDebuffBlocked()) { final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_RESISTED_YOUR_S2); sm.addCharName(target); @@ -1470,7 +1467,7 @@ public final class Formulas { return true; } - else if (target.calcStat(Stats.DEBUFF_IMMUNITY, 0, null, skill) > 0) + else if (target.isDebuffBlocked()) { return false; } @@ -2024,6 +2021,7 @@ public final class Formulas int cancelMagicLvl = skill.getMagicLevel(); final double vuln = target.calcStat(Stats.CANCEL_VULN, 0, target, null); final double prof = activeChar.calcStat(Stats.CANCEL_PROF, 0, target, null); + double resMod = 1 + (((vuln + prof) * -1) / 100); double finalRate = rate / resMod; diff --git a/trunk/java/com/l2jserver/gameserver/model/stats/Stats.java b/trunk/java/com/l2jserver/gameserver/model/stats/Stats.java index 524b46f7a4..232f0191de 100644 --- a/trunk/java/com/l2jserver/gameserver/model/stats/Stats.java +++ b/trunk/java/com/l2jserver/gameserver/model/stats/Stats.java @@ -136,8 +136,6 @@ public enum Stats HOLY_RES("holyRes"), DARK_RES("darkRes"), MAGIC_SUCCESS_RES("magicSuccRes"), - // BUFF_IMMUNITY("buffImmunity"), //TODO: Implement me - DEBUFF_IMMUNITY("debuffImmunity"), // ELEMENT POWER FIRE_POWER("firePower"), diff --git a/trunk/java/com/l2jserver/gameserver/network/L2GamePacketHandler.java b/trunk/java/com/l2jserver/gameserver/network/L2GamePacketHandler.java index e01c352583..e797db4f7d 100644 --- a/trunk/java/com/l2jserver/gameserver/network/L2GamePacketHandler.java +++ b/trunk/java/com/l2jserver/gameserver/network/L2GamePacketHandler.java @@ -743,7 +743,6 @@ public final class L2GamePacketHandler implements IPacketHandler, case 0xcf: // RequestProcureCrop // msg = new RequestBuyProcure(); break; - case 0xd0: int id2 = -1; if (buf.remaining() >= 2) diff --git a/trunk/java/com/l2jserver/gameserver/network/clientpackets/Action.java b/trunk/java/com/l2jserver/gameserver/network/clientpackets/Action.java index f86493adae..1afc2ba9d9 100644 --- a/trunk/java/com/l2jserver/gameserver/network/clientpackets/Action.java +++ b/trunk/java/com/l2jserver/gameserver/network/clientpackets/Action.java @@ -19,6 +19,7 @@ package com.l2jserver.gameserver.network.clientpackets; import com.l2jserver.Config; +import com.l2jserver.gameserver.enums.DuelState; import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.PcCondOverride; @@ -28,6 +29,7 @@ import com.l2jserver.gameserver.model.skills.AbnormalType; import com.l2jserver.gameserver.model.skills.BuffInfo; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; +import com.l2jserver.gameserver.network.serverpackets.SystemMessage; public final class Action extends L2GameClientPacket { @@ -107,6 +109,12 @@ public final class Action extends L2GameClientPacket return; } + if (obj.isPlayable() && (obj.getActingPlayer().getDuelState() == DuelState.DEAD)) + { + sendPacket(ActionFailed.STATIC_PACKET); + activeChar.getActingPlayer().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_OTHER_PARTY_IS_FROZEN_PLEASE_WAIT_A_MOMENT)); + return; + } if (!obj.isTargetable() && !activeChar.canOverrideCond(PcCondOverride.TARGET_ALL)) { sendPacket(ActionFailed.STATIC_PACKET); diff --git a/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestActionUse.java b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestActionUse.java index 166056ef76..6b4f7d6789 100644 --- a/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestActionUse.java +++ b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestActionUse.java @@ -45,6 +45,7 @@ import com.l2jserver.gameserver.model.effects.AbstractEffect; import com.l2jserver.gameserver.model.effects.L2EffectType; import com.l2jserver.gameserver.model.skills.AbnormalType; import com.l2jserver.gameserver.model.skills.BuffInfo; +import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; @@ -249,10 +250,10 @@ public final class RequestActionUse extends L2GameClientPacket activeChar.tryOpenPrivateBuyStore(); break; case 32: // Wild Hog Cannon - Wild Cannon - useSkill(4230, false); + useSkill("DDMagic", false); break; case 36: // Soulless - Toxic Smoke - useSkill(4259, false); + useSkill("RangeDebuff", false); break; case 37: // Dwarven Manufacture if (activeChar.isAlikeDead()) @@ -276,7 +277,7 @@ public final class RequestActionUse extends L2GameClientPacket activeChar.mountPlayer(pet); break; case 39: // Soulless - Parasite Burst - useSkill(4138, false); + useSkill("RangeDD", false); break; case 41: // Wild Hog Cannon - Attack if (validateSummon(servitor, false)) @@ -292,25 +293,25 @@ public final class RequestActionUse extends L2GameClientPacket } break; case 42: // Kai the Cat - Self Damage Shield - useSkill(4378, activeChar, false); + useSkill("HealMagic", false); break; - case 43: // Unicorn Merrow - Hydro Screw - useSkill(4137, false); + case 43: // Merrow the Unicorn - Hydro Screw + useSkill("DDMagic", false); break; case 44: // Big Boom - Boom Attack - useSkill(4139, false); + useSkill("DDMagic", false); break; - case 45: // Unicorn Boxer - Master Recharge - useSkill(4025, activeChar, false); + case 45: // Boxer the Unicorn - Master Recharge + useSkill("HealMagic", activeChar, false); break; case 46: // Mew the Cat - Mega Storm Strike - useSkill(4261, false); + useSkill("DDMagic", false); break; case 47: // Silhouette - Steal Blood - useSkill(4260, false); + useSkill("DDMagic", false); break; case 48: // Mechanic Golem - Mech. Cannon - useSkill(4068, false); + useSkill("DDMagic", false); break; case 51: // General Manufacture // Player shouldn't be able to set stores if he/she is alike dead (dead or fake death) @@ -459,97 +460,91 @@ public final class RequestActionUse extends L2GameClientPacket } break; case 1003: // Wind Hatchling/Strider - Wild Stun - useSkill(4710, true); + useSkill("PhysicalSpecial", true); break; case 1004: // Wind Hatchling/Strider - Wild Defense - useSkill(4711, activeChar, true); + useSkill("Buff", activeChar, true); break; case 1005: // Star Hatchling/Strider - Bright Burst - useSkill(4712, true); + useSkill("DDMagic", true); break; case 1006: // Star Hatchling/Strider - Bright Heal - useSkill(4713, activeChar, true); + useSkill("Heal", activeChar, true); break; - case 1007: // Cat Queen - Blessing of Queen - useSkill(4699, activeChar, false); + case 1007: // Feline Queen - Blessing of Queen + useSkill("Buff1", activeChar, false); break; - case 1008: // Cat Queen - Gift of Queen - useSkill(4700, activeChar, false); + case 1008: // Feline Queen - Gift of Queen + useSkill("Buff2", activeChar, false); break; - case 1009: // Cat Queen - Cure of Queen - useSkill(4701, false); + case 1009: // Feline Queen - Cure of Queen + useSkill("DDMagic", false); break; case 1010: // Unicorn Seraphim - Blessing of Seraphim - useSkill(4702, activeChar, false); + useSkill("Buff1", activeChar, false); break; case 1011: // Unicorn Seraphim - Gift of Seraphim - useSkill(4703, activeChar, false); + useSkill("Buff2", activeChar, false); break; case 1012: // Unicorn Seraphim - Cure of Seraphim - useSkill(4704, false); + useSkill("DDMagic", false); break; case 1013: // Nightshade - Curse of Shade - useSkill(4705, false); + useSkill("DeBuff1", false); break; case 1014: // Nightshade - Mass Curse of Shade - useSkill(4706, false); + useSkill("DeBuff2", false); break; case 1015: // Nightshade - Shade Sacrifice - useSkill(4707, false); + useSkill("Heal", false); break; case 1016: // Cursed Man - Cursed Blow - useSkill(4709, false); + useSkill("PhysicalSpecial1", false); break; - case 1017: // Cursed Man - Cursed Strike/Stun - useSkill(4708, false); + case 1017: // Cursed Man - Cursed Strike + useSkill("PhysicalSpecial2", false); break; case 1031: // Feline King - Slash - useSkill(5135, false); + useSkill("PhysicalSpecial1", false); break; case 1032: // Feline King - Spinning Slash - useSkill(5136, false); + useSkill("PhysicalSpecial2", false); break; - case 1033: // Feline King - Grip of the Cat - useSkill(5137, false); + case 1033: // Feline King - Hold of King + useSkill("PhysicalSpecial3", false); break; case 1034: // Magnus the Unicorn - Whiplash - useSkill(5138, false); + useSkill("PhysicalSpecial1", false); break; case 1035: // Magnus the Unicorn - Tridal Wave - useSkill(5139, false); + useSkill("PhysicalSpecial2", false); break; case 1036: // Spectral Lord - Corpse Kaboom - useSkill(5142, false); + useSkill("PhysicalSpecial1", false); break; case 1037: // Spectral Lord - Dicing Death - useSkill(5141, false); + useSkill("PhysicalSpecial2", false); break; - case 1038: // Spectral Lord - Force Curse - useSkill(5140, false); + case 1038: // Spectral Lord - Dark Curse + useSkill("PhysicalSpecial3", false); break; case 1039: // Swoop Cannon - Cannon Fodder - if ((target != null) && target.isDoor()) - { - useSkill(5110, false); - } + useSkill(5110, false); break; case 1040: // Swoop Cannon - Big Bang - if ((target != null) && target.isDoor()) - { - useSkill(5111, false); - } + useSkill(5111, false); break; case 1041: // Great Wolf - Bite Attack - useSkill(5442, true); + useSkill("Skill01", true); break; case 1042: // Great Wolf - Maul - useSkill(5444, true); + useSkill("Skill03", true); break; case 1043: // Great Wolf - Cry of the Wolf - useSkill(5443, true); + useSkill("Skill02", true); break; case 1044: // Great Wolf - Awakening - useSkill(5445, true); + useSkill("Skill04", true); break; case 1045: // Great Wolf - Howl useSkill(5584, true); @@ -570,34 +565,34 @@ public final class RequestActionUse extends L2GameClientPacket useSkill(5583, false); break; case 1051: // Feline Queen - Bless The Body - useSkill(5638, false); + useSkill("buff3", false); break; case 1052: // Feline Queen - Bless The Soul - useSkill(5639, false); + useSkill("buff4", false); break; case 1053: // Feline Queen - Haste - useSkill(5640, false); + useSkill("buff5", false); break; case 1054: // Unicorn Seraphim - Acumen - useSkill(5643, false); + useSkill("buff3", false); break; case 1055: // Unicorn Seraphim - Clarity - useSkill(5647, false); + useSkill("buff4", false); break; case 1056: // Unicorn Seraphim - Empower - useSkill(5648, false); + useSkill("buff5", false); break; case 1057: // Unicorn Seraphim - Wild Magic - useSkill(5646, false); + useSkill("buff6", false); break; case 1058: // Nightshade - Death Whisper - useSkill(5652, false); + useSkill("buff3", false); break; case 1059: // Nightshade - Focus - useSkill(5653, false); + useSkill("buff4", false); break; case 1060: // Nightshade - Guidance - useSkill(5654, false); + useSkill("buff5", false); break; case 1061: // Wild Beast Fighter, White Weasel - Death blow useSkill(5745, true); @@ -630,7 +625,7 @@ public final class RequestActionUse extends L2GameClientPacket useSkill(5771, true); break; case 1071: // Tigress - Power Strike - useSkill(5761, true); + useSkill("DDMagic", true); break; case 1072: // Toy Knight - Piercing attack useSkill(6046, true); @@ -1046,18 +1041,8 @@ public final class RequestActionUse extends L2GameClientPacket return; } - if (summon instanceof L2BabyPetInstance) + if (!canControl(summon)) { - if (!((L2BabyPetInstance) summon).isInSupportMode()) - { - sendPacket(SystemMessageId.A_PET_ON_AUXILIARY_MODE_CANNOT_USE_SKILLS); - return; - } - } - - if ((summon.getLevel() - activeChar.getLevel()) > 20) - { - sendPacket(SystemMessageId.YOUR_PET_IS_TOO_HIGH_LEVEL_TO_CONTROL); return; } @@ -1092,6 +1077,69 @@ public final class RequestActionUse extends L2GameClientPacket } } + private void useSkill(String skillName, L2Object target, boolean pet) + { + final L2PcInstance activeChar = getActiveChar(); + if (activeChar == null) + { + return; + } + + final L2Summon summon = activeChar.getPet(); + if (!validateSummon(summon, pet)) + { + return; + } + + if (!canControl(summon)) + { + return; + } + + if (summon instanceof L2BabyPetInstance) + { + if (!((L2BabyPetInstance) summon).isInSupportMode()) + { + sendPacket(SystemMessageId.A_PET_ON_AUXILIARY_MODE_CANNOT_USE_SKILLS); + return; + } + } + final Skill skill = summon.getTemplate().getParameters().getSkillHolder(skillName).getSkill(); + + if (skill != null) + { + summon.setTarget(target); + summon.useMagic(skill, _ctrlPressed, _shiftPressed); + + if (skill.getId() == SWITCH_STANCE_ID) + { + summon.switchMode(); + } + } + } + + private boolean canControl(L2Summon summon) + { + if (summon instanceof L2BabyPetInstance) + { + if (!((L2BabyPetInstance) summon).isInSupportMode()) + { + sendPacket(SystemMessageId.A_PET_ON_AUXILIARY_MODE_CANNOT_USE_SKILLS); + return false; + } + } + + if (summon.isPet()) + { + if ((summon.getLevel() - getActiveChar().getLevel()) > 20) + { + sendPacket(SystemMessageId.YOUR_PET_IS_TOO_HIGH_LEVEL_TO_CONTROL); + return false; + } + } + return true; + } + /** * Cast a skill for active summon.
* Target is retrieved from owner's target, then validated by overloaded method useSkill(int, L2Character). @@ -1109,6 +1157,23 @@ public final class RequestActionUse extends L2GameClientPacket useSkill(skillId, activeChar.getTarget(), pet); } + /** + * Cast a skill for active summon.
+ * Target is retrieved from owner's target, then validated by overloaded method useSkill(int, L2Character). + * @param skillName the skill name to use + * @param pet if {@code true} it'll validate a pet, if {@code false} it will validate a servitor + */ + private void useSkill(String skillName, boolean pet) + { + final L2PcInstance activeChar = getActiveChar(); + if (activeChar == null) + { + return; + } + + useSkill(skillName, activeChar.getTarget(), pet); + } + /** * Cast a skill for all active summon.
* Target is retrieved from owner's target diff --git a/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestDuelAnswerStart.java b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestDuelAnswerStart.java index 01bb012be0..c0047f5fe9 100644 --- a/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestDuelAnswerStart.java +++ b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestDuelAnswerStart.java @@ -94,7 +94,7 @@ public final class RequestDuelAnswerStart extends L2GameClientPacket player.sendPacket(msg1); requestor.sendPacket(msg2); - DuelManager.getInstance().addDuel(requestor, player, _partyDuel); + DuelManager.getInstance().addDuel(requestor, player, _partyDuel == 1 ? true : false); } else if (_response == -1) { diff --git a/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestDuelStart.java b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestDuelStart.java index eddae08fd6..4d14d56b71 100644 --- a/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestDuelStart.java +++ b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestDuelStart.java @@ -19,6 +19,7 @@ package com.l2jserver.gameserver.network.clientpackets; import com.l2jserver.Config; +import com.l2jserver.gameserver.instancemanager.DuelManager; import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.SystemMessageId; @@ -48,87 +49,65 @@ public final class RequestDuelStart extends L2GameClientPacket { L2PcInstance activeChar = getClient().getActiveChar(); L2PcInstance targetChar = L2World.getInstance().getPlayer(_player); - if (activeChar == null) + boolean isPartyDuel = _partyDuel == 1 ? true : false; + if ((activeChar == null) || (targetChar == null)) { return; } - if (targetChar == null) - { - activeChar.sendPacket(SystemMessageId.THERE_IS_NO_OPPONENT_TO_RECEIVE_YOUR_CHALLENGE_FOR_A_DUEL); - return; - } if (activeChar == targetChar) { - activeChar.sendPacket(SystemMessageId.THERE_IS_NO_OPPONENT_TO_RECEIVE_YOUR_CHALLENGE_FOR_A_DUEL); + if (isPartyDuel) + { + activeChar.sendPacket(SystemMessageId.THERE_IS_NO_OPPONENT_TO_RECEIVE_YOUR_CHALLENGE_FOR_A_DUEL); + } return; } - - // Check if duel is possible - if (!activeChar.canDuel()) - { - activeChar.sendPacket(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME); - return; - } - else if (!targetChar.canDuel()) - { - activeChar.sendPacket(targetChar.getNoDuelReason()); - return; - } - // Players may not be too far apart - else if (!activeChar.isInsideRadius(targetChar, 250, false, false)) + if (!activeChar.isInsideRadius(targetChar, 250, false, false)) { SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_TOO_FAR_AWAY_TO_RECEIVE_A_DUEL_CHALLENGE); msg.addString(targetChar.getName()); activeChar.sendPacket(msg); return; } - else if (Config.FACTION_SYSTEM_ENABLED && ((activeChar.isEvil() && targetChar.isGood()) || (activeChar.isGood() && targetChar.isEvil()))) + if (Config.FACTION_SYSTEM_ENABLED && ((activeChar.isEvil() && targetChar.isGood()) || (activeChar.isGood() && targetChar.isEvil()))) { activeChar.sendPacket(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME); return; } + // Check if duel is possible + if (!DuelManager.canDuel(activeChar, activeChar, isPartyDuel)) + { + return; + } + if (!DuelManager.canDuel(activeChar, targetChar, isPartyDuel)) + { + return; + } // Duel is a party duel - if (_partyDuel == 1) + if (isPartyDuel) { // Player must be in a party & the party leader - if (!activeChar.isInParty() || !activeChar.getParty().isLeader(activeChar)) + if (!activeChar.isInParty() || !activeChar.getParty().isLeader(activeChar) || !targetChar.isInParty() || activeChar.getParty().containsPlayer(targetChar)) { - activeChar.sendMessage("You have to be the leader of a party in order to request a party duel."); - return; - } - // Target must be in a party - else if (!targetChar.isInParty()) - { - activeChar.sendPacket(SystemMessageId.SINCE_THE_PERSON_YOU_CHALLENGED_IS_NOT_CURRENTLY_IN_A_PARTY_THEY_CANNOT_DUEL_AGAINST_YOUR_PARTY); - return; - } - // Target may not be of the same party - else if (activeChar.getParty().containsPlayer(targetChar)) - { - activeChar.sendMessage("This player is a member of your own party."); + activeChar.sendPacket(SystemMessageId.YOU_ARE_UNABLE_TO_REQUEST_A_DUEL_AT_THIS_TIME); return; } // Check if every player is ready for a duel for (L2PcInstance temp : activeChar.getParty().getMembers()) { - if (!temp.canDuel()) + if (!DuelManager.canDuel(activeChar, temp, isPartyDuel)) { - activeChar.sendMessage("Not all the members of your party are ready for a duel."); return; } } - L2PcInstance partyLeader = null; // snatch party leader of targetChar's party + L2PcInstance partyLeader = targetChar.getParty().getLeader(); // snatch party leader of targetChar's party + for (L2PcInstance temp : targetChar.getParty().getMembers()) { - if (partyLeader == null) + if (!DuelManager.canDuel(activeChar, temp, isPartyDuel)) { - partyLeader = temp; - } - if (!temp.canDuel()) - { - activeChar.sendPacket(SystemMessageId.THE_OPPOSING_PARTY_IS_CURRENTLY_UNABLE_TO_ACCEPT_A_CHALLENGE_TO_A_DUEL); return; } }